这是我自己定制的nuget包,我还没有发布和测试本地。Nuget - 软件包恢复失败。回滚'WebApplication1'的软件包更改。 0
nuget包包含一个dll文件和nuspec文件如下。
<?xml version="1.0"?>
<package >
<metadata>
<id>MyLib</id>
<version>1.0.0</version>
<authors>Author</authors>
<owners>Owner</owners>
<licenseUrl>license url</licenseUrl>
<projectUrl>project url</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>some description</copyright>
<tags>Tag1 Tage2</tags>
</metadata>
<files>
<file src="bin\Debug\netstandard1.4\*.dll" target="lib" />
<file src="bin\Debug\netstandard1.4\*.pdb" target="lib" />
</files>
</package>
我复制nupkg文件的位置,并把它添加到
Visual studio Tools -> Options -> Packages -> sources directory
错误:
Package MyLib 1.0.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package MyLib 1.0.0 supports: net (.NETFramework,Version=v0.0)
Package restore failed. Rolling back package changes for 'WebApplication1'.
不知道我怎么能解决问题,或者找到更多信息。
更多信息
该DLL文件是使用模板(.NET框架4.5.2)创建
Templates -> Visual C# -> .NET Core -> Class Library (.NET Standard)
Web应用程序是使用模板装箱。 (空Web应用程序)
Templates -> Visual C# -> .NET Core -> ASP.NET Core Web Application (.NET Core)
编辑
我发现下Output
窗口
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
我应该创建什么样的类库这与.NETCoreApp兼容更多的细节?
EDIT2
我看到这个URL。它建议使用dotnet.exe pack --no-build
创建nupkg,而之前我从nuget.org下载nuget.exe
来创建该包。
我想上面的命令,但随后的Visual Studio说
"... Target pack doesn't exists in the project ... "
本网站随后说明,以及但是失败URL
对不起,为什么你提到.Net Framework 4.5.2如果你想要的目标.netcore? –
是的,当我选择'新建项目 - >模板 - >。核心 - >类库框架(.NET标准)'时,我也感到困惑,.NET Framework 4.5.2列在对话框的顶部在下拉菜单中(这就是为什么我提到),所以我不知道应该选择什么样的项目模板来创建与.net核心一起使用的正确类型的dll。 – user2727195
你见过这[一](https://docs.microsoft.com/en-us/nuget/guides/create-net-standard-packages-vs2017)吗?也就是说'使用NuGet 4.0和.NET Core项目,包元数据直接包含在.csproj中' –