简体   繁体   English

针对不同.NET Framework的参考Nuget包

[英]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.

相关问题 通过 nuget 与手动参考在 .NET 标准中使用 .NET 框架程序集时的不同错误 - Different errors when using .NET framework assembly in .NET standard via nuget vs manual reference 用于ASP.Net Core和Full Framework项目的bootstrap.sass nuget软件包的不同安装 - Different installation for bootstrap.sass nuget package for ASP.Net Core and Full framework projects In .NET Core, ASP.NET Core - What is the relationship between Package, Reference, NuGet Package, DLL file, Namespace - In .NET Core, ASP.NET Core - What is the relationship between Package, Reference, NuGet Package, DLL file, Namespace 参考问题system.net.http nuget包4.3.1可能无法加载system.net.http 4.1.1 - reference problems system.net.http nuget package 4.3.1 coul not load system.net.http 4.1.1 完整.NET Framework上ASP.NET Core项目内的NuGet文件夹中的参考DLL - Reference DLL from NuGet folder inside ASP.NET Core project on full .NET framework .NET 框架版本 4.7.2 与 Microsoft.Net.Httpclient 不兼容 NuGet Package - .NET framework version 4.7.2 is not compatible with Microsoft.Net.Httpclient NuGet Package .NET属性在不同目标上的优先级 - .NET Attributes prioritize on different targets 发布同名的nuget包时,请在.net vNext中引用本地项目 - Reference local project in .net vNext when a nuget package of the same name is published 程序集生成-参考程序集针对不同的处理器 - Assembly generation - Reference assembly targets different processor Nuget软件包更新后缺少参考 - Reference Missing After Nuget Package Update
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM