小编sti*_*vex的帖子

我无法使用Visual Studio 2015中的Xamarin Mac Agent连接到Mac

我正在继续冒险与Xamarin.

我正在开发一个带有可移植类库(PCL)的Xamarin Forms应用程序.

我已经通过Android编译和调试了我的应用程序,但是现在,我有兴趣在iOS中运行应用程序来测试这个平台.

我的PC和Mac之间的连接有问题.

我有一台装有Xamarin工具的Visual Studio Community 2015的PC(Windows 8.1).

在我的Mac Mini中,我安装了OS X(v10.11.3),XCode(v7.2)和Xamarin Studio.我已经使用我的Xamarin帐户登录了.

在这两台机器中,我有相同的Xamarin版本.

我跟随了Xamarin演练.

在Visual Studio上,我打开Xamarin Mac Agent.它找到我的Mac Mini.然后它会问我Mac凭证(用户名和密码).

在此输入图像描述

此时登录工作正常.

在此输入图像描述

然后,在解决方案中,我将iOS项目设置为启动项目.我清理解决方案,我再次构建并启动编译/调试过程(F5).

在这一点上,输出检索一条消息:

1>连接到Mac服务器Macs-Mac-mini.local ...

1> C:\ Program Files(x86)\ MSBuild\Xamarin\iOS\Xamarin.iOS.Windows.After.targets(54,5):警告:无法使用现有的ssh密钥对用户进行身份验证

1> C:\ Program Files(x86)\ MSBuild\Xamarin\iOS\Xamarin.iOS.Windows.After.targets(54,5):错误:无法连接到地址='Macs-Mac-mini.local'用户='macmini

我已经使用Putty(SSH客户端)检查我的用户/密码,如果我能够连接到Mac,我已经取得了成功.

进入/Users/macmini2/.ssh/authorized_keys文件(Mac机器)每次我使用Xamarin Mac Agent时,Visual Studio都会添加一个新的密钥条目(它重复添加相同的内容).

我看到问题可能与ssh键有关.为什么我有这个问题?我究竟做错了什么?

我测试的一件事就是直接在Mac上用Xamarin Studio打开Xamarin项目,构建它并运行模拟器.有用.

我见过其他类似的问题,但我认为它没有同样的问题.

编辑:

我尝试编译/调试时有关错误的更多具体信息:

Could not authenticate the user using the existing ssh keys
Xamarin.Messaging.VisualStudio.MessagingAuthenticationException: Could not authenticate the user using the existing ssh keys ---> Renci.SshNet.Common.SshAuthenticationException: Permission denied (publickey).
   en Renci.SshNet.ClientAuthentication.Authenticate(IConnectionInfoInternal connectionInfo, …
Run Code Online (Sandbox Code Playgroud)

debugging macos xamarin.ios xamarin.forms visual-studio-2015

20
推荐指数
4
解决办法
3万
查看次数

如何在样式资源字典中绑定颜色?

我正在开发带有可移植类库 (PCL) 的 Xamarin Forms 应用程序。

总是,我喜欢将资源尽可能排序到 XAML 文件中。我已经看到无法直接创建 XAML 资源文件。我的解决方案是删除 App.cs 文件(在 Portable 项目上)并创建一个 Forms Xaml 页面作为模板。我已将旧 App.cs 中的代码复制到 App.xaml.cs,然后我编辑了 xaml 文件。

在 App.xaml 文件中,我定义了标签的颜色和样式。当我将颜色绑定到样式声明时,它在运行时失败。

<Application xmlns="http://xamarin.com/schemas/2014/forms" 
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
         ...>
<Application.Resources>
<ResourceDictionary>

  <!-- LABELS -->
  <Style x:Key="labelProductReference" TargetType="Label" 
         BasedOn="{StaticResource labelBase}" >
    <Setter Property="FontSize" Value="22" />
    <Setter Property="FontAttributes" Value="Bold" />
    <Setter Property="HorizontalOptions" Value="StartAndExpand" />
    <Setter Property="TextColor" Value="{StaticProperty textPrimaryColor}"
  </Style>

   ...

  <!-- COLORS -->
  <Color x:Key="textPrimaryColor">#FFFFFF</Color>

   ...

 </ResourceDictionary>
</Application.Resources>
</Application>
Run Code Online (Sandbox Code Playgroud)

错误说:

Xamarin.Forms.Xaml.XamlParseException:位置 45:38。找不到关键 textPrimaryColor 的静态资源

但是,如果我将有标签的颜色绑定到页面(MainPage.xaml)中,它会起作用:

<Label Text="{Binding Reference}" TextColor="{StaticResource textPrimaryColor}" 
               Style="{StaticResource …
Run Code Online (Sandbox Code Playgroud)

xaml portable-class-library xamarin xamarin.forms visual-studio-2015

3
推荐指数
1
解决办法
2965
查看次数