从面向 .Net 4.0 客户端配置文件的 Win Forms 应用程序引用由 asp.net 5 class 库创建的 nuget 包
Referencing a nuget package create by an asp.net 5 class library from a Win Forms app targeting .Net 4.0 Client Profile
我有一个 asp.net 5 class 库,其中包含我需要与面向 .Net Framework 4.0 客户端配置文件的 WinForms 应用程序共享的对象模型。
我已经从 asp.net 5 class 库创建了一个 Nuget 包,并尝试从 WinForms 应用程序引用这个 NuGet 包。但是,在添加引用时出现以下错误:
Could not install package 'package name 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', 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.
我尝试在 project.json 文件的 "frameworks" 部分添加 DNX40 作为目标框架,如下所示。
{
"authors": [ "author" ],
"dependencies": {
},
"description": "Shared object models",
"frameworks": {
"dnx40": { },
"dnx451": { },
"dnxcore50": {
"dependencies": {
"System.Collections": "4.0.10-beta-22816",
"System.Linq": "4.0.0-beta-22816",
"System.Threading": "4.0.10-beta-22816",
"Microsoft.CSharp": "4.0.0-beta-22816"
}
}
},
"licenseUrl": "",
"projectUrl": "",
"tags": [ "" ],
"version": "1.0.0-*"
}
我怀疑我定位的框架版本不对。
但是如何将 .Net Framework 4.0 Client Profile 指定为目标框架?这可能吗?
使用net40
:
"frameworks": {
"net40": {},
"dnx451": { },
"dnxcore50": {}
}
我有一个 asp.net 5 class 库,其中包含我需要与面向 .Net Framework 4.0 客户端配置文件的 WinForms 应用程序共享的对象模型。
我已经从 asp.net 5 class 库创建了一个 Nuget 包,并尝试从 WinForms 应用程序引用这个 NuGet 包。但是,在添加引用时出现以下错误:
Could not install package 'package name 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', 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.
我尝试在 project.json 文件的 "frameworks" 部分添加 DNX40 作为目标框架,如下所示。
{
"authors": [ "author" ],
"dependencies": {
},
"description": "Shared object models",
"frameworks": {
"dnx40": { },
"dnx451": { },
"dnxcore50": {
"dependencies": {
"System.Collections": "4.0.10-beta-22816",
"System.Linq": "4.0.0-beta-22816",
"System.Threading": "4.0.10-beta-22816",
"Microsoft.CSharp": "4.0.0-beta-22816"
}
}
},
"licenseUrl": "",
"projectUrl": "",
"tags": [ "" ],
"version": "1.0.0-*"
}
我怀疑我定位的框架版本不对。
但是如何将 .Net Framework 4.0 Client Profile 指定为目标框架?这可能吗?
使用net40
:
"frameworks": {
"net40": {},
"dnx451": { },
"dnxcore50": {}
}