在 Windows Phone 8.1 应用程序项目中安装 Unity nuget 包时出错

Error installing Unity nuget package in Windows Phone 8.1 app project

我 运行 Visual Studio 2015 年 Windows 10.

文件 -> 新建项目 -> 空白应用程序(通用 Windows 8.1)

这将创建一个包含 3 个项目的解决方案:一个 Windows 8.1 项目、一个 Windows Phone 8.1 项目和一个共享项目。

如果我尝试安装 Unity nuget 包,我会收到以下错误

Package Manager Console Host Version 3.1.1.0

Type 'get-help NuGet' to see all available NuGet commands.

PM> Install-Package Unity -Version 3.5.1404
Attempting to gather dependencies information for package 'Unity.3.5.1404' with respect to project 'App3\App3.WindowsPhone', targeting 'WindowsPhoneApp,Version=v8.1'
Attempting to resolve dependencies for package 'Unity.3.5.1404' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Unity.3.5.1404'
Resolved actions to install package 'Unity.3.5.1404'
Install failed. Rolling back...
Package 'Unity 3.5.1404' does not exist in project 'App3.WindowsPhone'
Install-Package : Could not install package 'Unity 3.5.1404'. You are trying to install this package into a project that targets 'WindowsPhoneApp,Version=v8.1', but the package does not contain any assembly references or content files that are compatible with 
that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Unity -Version 3.5.1404
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

PM> 

Unity 正确安装到 Windows 8.1 项目中。

如何解决这个问题?

更新:2015 年 9 月 16 日 我在我的工作 PC 运行 Windows 10 和 Visual Studio 2013 上得到相同的行为。

更新:2015 年 9 月 17 日 设置 nuget 以显示预发布包,然后安装 Unity 3.5.1405-prerelease。

Unity NuGet 包版本 3.5.1404 不支持通用 Windows 项目。

它确实支持 Windows Phone Silverlight 项目。

如果您创建 Windows Phone Silverlight 项目,您可以将 Unity NuGet 包安装到其中。

我可以通过以下 nuget 命令将 unity 安装到两个项目中:

Install-Package Unity -Pre

这将安装 3.5.1405 预发行版。根据 Unity 的 nuget 页面,WindowsPhone 和 WindowsPhone8 都列在标签部分。