[英]Reference Nuget Package that targets different .NET Framework
After recently migrated from ASP.NET Core RC1 to RC2, I am unable to reference dlls directly anymore. 最近从ASP.NET Core RC1迁移到RC2之后,我再也无法直接引用dll。 Visual Studio tells me that I can only reference Nuget packages.
Visual Studio告诉我,我只能引用Nuget包。
So I have built a local Nuget package from the assembly. 所以我从程序集中构建了一个本地的Nuget包。 I am able to install the package without any errors.
我能够安装该软件包而不会出现任何错误。 I have no issues performing a
dotnet restore
. 我没有执行
dotnet restore
问题。 However, I am unable to reference any of the namespaces of the assembly. 但是,我无法引用程序集的任何名称空间。
The referenced package name is spfcommon.dll
, and the assembly targets .Net Framework 4.0
. 引用的程序包名称是
spfcommon.dll
,程序集的目标是.Net Framework 4.0
。 My project targets .Net Framework 4.5.1
. 我的项目针对
.Net Framework 4.5.1
。 I don't know if the difference in target frameworks is causing this issue. 我不知道目标框架的差异是否会导致此问题。
My project.json file: 我的project.json文件:
"frameworks": {
"net451": {
"dependencies": {
},
"frameworkAssemblies": {
"System.Runtime": "4.0.10.0"
}
}
},
"dependencies": {
"Common": "4.0.0-*",
"Data": "4.0.0-*",
"spfcommon.dll": "1.0.1" <-- Cannot reference namespaces
},
The error is: 错误是:
The type or namespace name 'SPF' could not be found (are you missing a using directive or an assembly reference?)
找不到类型或名称空间名称“ SPF”(是否缺少using指令或程序集引用?)
Any help is appreciated. 任何帮助表示赞赏。
Had a very similar problem today, caused me a few hours grief but I found that if I deleted the "wrap" folder and then restored the packages it would work again. 今天遇到了一个非常类似的问题,这使我痛苦了几个小时,但是我发现,如果删除“ wrap”文件夹然后恢复软件包,它将可以再次使用。
Hopefully it's the same as your issue. 希望这与您的问题相同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.