【问题标题】:Nuget fails to add lightinject 4.0.6 to portable class libraryNuget 无法将 lightinject 4.0.6 添加到可移植类库
【发布时间】:2016-02-06 09:46:28
【问题描述】:

我正在尝试将 lightinject 用于 xamarin 应用程序。公共代码位于单独的可移植类库中。此项目配置为 TargetFrameWorkProfile Profile78。当我添加 lightinject 4.0.6 时出现以下错误:

Attempting to gather dependencies information for package 'LightInject.4.0.6' with respect to project 'ProjectName', targeting '.NETPortable,Version=v4.5,Profile=Profile78'
Attempting to resolve dependencies for package 'LightInject.4.0.6' with DependencyBehavior 'Lowest'
Resolving actions to install package 'LightInject.4.0.6'
Resolved actions to install package 'LightInject.4.0.6'
Install failed. Rolling back...
Package 'LightInject.4.0.6 : ' does not exist in project 'ProjectName'
Package 'LightInject.4.0.6 : ' does not exist in folder '<path_to_packages_folder>'
Could not install package 'LightInject 4.0.6'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile78', 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.

我找到了this issue,所以我尝试切换到 Profile111,但即使使用此配置文件,也无法将这个库添加到 PCL。

也许我错过了其他东西?

【问题讨论】:

    标签: xamarin visual-studio-2015 nuget portable-class-library light-inject


    【解决方案1】:

    更改了配置文件 111 的 TFM。 https://github.com/seesharper/LightInject/commit/8ddb35723d460c0007ac63d7fe249874fbccb960

    LightInject 4.0.7 刚刚发布到官方 NuGet 源。

    【讨论】:

      【解决方案2】:

      查看 LightInject 4.0.6 NuGet 包,它有一个可移植类库文件夹:

      net45+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10
      

      Mono 和 Xamarin 部分是可选的,所以如果我们忽略这些部分,我们有:

      net45+win81+wpa81
      

      PCL 配置文件 111 如下,忽略任何 Mono 和 Xamarin 框架:

      net45+win+wpa81
      

      这里的win表示win8(Windows 8)。

      查看 Profile 111 和 LightInject NuGet 包,它们不兼容。 LightInject 支持 win81 (Windows 8.1) 作为其配置文件的一部分,而 PCL 配置文件 111 支持 win8。为了使 LigthInject 兼容,它必须针对 win8 而不是 win81。

      似乎没有与 LightInject 目标相匹配的确切 PCL 配置文件。最接近的是 Profile 151:

      net451+win81+wpa81
      

      更改可移植类库使其以 Profile 151 为目标允许安装 LightInject。它似乎是我能看到的唯一兼容的配置文件。

      【讨论】:

      • 当我尝试将我的 PCL 目标从 Windows 8 更改为 Windows 8.1 或 Windows Universal 10 时,Visual Studio 说“以下将自动成为目标,因为它们支持同一组可移植 API:Windows 8"。所以我不能在不禁用它的情况下更改 Windows 8...
      • 您可以在 Visual Studio 2015 中更改它。除了 .NET Framework 4.5.1、Windows 8.1 和 Windows Phone 8.1 之外,我取消选中了目标对话框中的所有内容。或者您可以直接在文本编辑器中编辑 .csproj 并更改配置文件。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-10
      • 1970-01-01
      • 1970-01-01
      • 2013-10-18
      • 2015-11-12
      • 1970-01-01
      相关资源
      最近更新 更多