【问题标题】:Xamarin Studio Mac, Portable class library, Async and AndroidXamarin Studio Mac、便携式类库、Async 和 Android
【发布时间】:2013-09-13 14:08:40
【问题描述】:

编辑:在 Alpha 通道 Profile7 上,Profile49 和 Profile78 似乎工作。 我正在使用此处描述的设置: Getting PCL, Mvvmcross, Nuget and Xamarin Studio to play "nice" on Mac.

如何在具有异步支持的 Xamarin Studio 中制作 PCL。

我通常使用 Profile104,它是 TargetFrameworkVersion v4.0

我尝试了以下三种不同 v4.5 配置文件的组合 Profile7、Profile49、Profile78 与不同版本的 Xamarin Studio:

                              Profile7     Profile 49    Profile 78
Alpha (4.1.10, mono=3.2.2)     1            1             1
Beta (4.0.12, mono=3.2.1)      2            2             2
Stable (4.0.12, mono=3.2.0)    1            1             1
  1. 未找到 System.Type、System.Threading。无法使用
  2. 找不到配置文件:/Library/Frameworks/Mono.framework/Versions/3.2.1/lib/mono/xbuild/Microsoft/Portable/v4.5/Microsoft.Portable.CSharp.targets 丢失

基本上没有 4.5 配置文件在任何当前可用的 Mac 版 Xamarin Studio 中运行。

【问题讨论】:

    标签: asynchronous xamarin.android portable-class-library xamarin-studio


    【解决方案1】:

    编辑:这些说明适用于稳定频道。在 Alpha 通道上,您可以使用 Profile 158, v4.0,它可以与异步正常工作。

    以下设置似乎适用于 Android,尚未尝试使用 Touch。

    1. 将您的 PCL 项目设置为 4.0 Profile 104,在您的 csproj 中,这些行是:

      <TargetFrameworkProfile>Profile104</TargetFrameworkProfile>
      <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
      
    2. 在您的 PCL 项目中,“管理 Nuget 包”,搜索 Async,添加 ID 为:Microsoft.Bcl.Async 的包

    3. 您的异步代码现在应该在 PCL 中编译,但是 Android 项目会抱怨缺少 dll,您不能(或者可能不应该)向其中添加 Async Targeting Pack。

    4. 在 Android 项目的选项、构建/Android 构建的链接器选项卡上,将以下内容添加到“忽略程序集”:System.Threading.Tasks.dll;Microsoft.Threading.Tasks.dll;Microsoft.Threading.Tasks.Extensions.dll。我的 csproj 包含以下几行:

      <AndroidLinkSkip>System.Threading.Tasks.dll;Microsoft.Threading.Tasks.dll;Microsoft.Threading.Tasks.Extensions.dll</AndroidLinkSkip>
      

    您可能需要重新启动 Xamarin Studio,在我的机器上,“忽略程序集”无法立即在其中一个 Droid 测试项目上运行。

    您的 Android 项目现在应该在 PCL 依赖项中使用异步支持构建和部署。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多