我正在尝试将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。
也许我错过了其他的东西?
答案 0 :(得分:0)
查看LightInject 4.0.6 NuGet包,它有一个可移植的类库文件夹:
net45+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10
Mono和Xamarin部分是可选的,所以如果我们忽略这些,我们有:
net45+win81+wpa81
PCL profile 111如下,忽略任何Mono和Xamarin框架:
net45+win+wpa81
win在这里意味着win8(Windows 8)。
查看Profile 111和LightInject NuGet包,它们不兼容。 LightInject支持win81(Windows 8.1)作为其配置文件的一部分,而PCL Profile 111支持win8。为了使LigthInject兼容,它必须以win8而不是win81为目标。
似乎没有一个确切的PCL配置文件与LightInject似乎的目标相匹配。最近的是Profile 151:
net451+win81+wpa81
更改可移植类库,使其以Profile 151为目标,可以安装LightInject。它似乎是我能看到的唯一兼容的配置文件。
答案 1 :(得分:0)
更改配置文件111的TFM。 https://github.com/seesharper/LightInject/commit/8ddb35723d460c0007ac63d7fe249874fbccb960
LightInject 4.0.7刚刚发布到NuGet官方Feed中。