我创建了一个nuget包,我的“ netcoreapp2.2”项目之一引用了它。
该程序包的nuspec支持多个框架:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MyPackage</id>
<version>1.0.0.0</version>
<description>Description</description>
<authors>Me</authors>
<dependencies>
<group targetFramework=".NETFramework4.0">
<dependency id="Dapper.StrongName" version="1.50.5" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Dapper.StrongName" version="1.50.5" />
</group>
</dependencies>
</metadata>
<files>
<file src="bin\Release\net452\MyPackage.dll" target="lib\net40\" />
<file src="bin\Release\net452\MyPackage.pdb" target="lib\net40\" />
<file src="bin\Release\netstandard2.0\MyPackage.dll" target="lib\netstandard2.0\" />
<file src="bin\Release\netstandard2.0\MyPackage.pdb" target="lib\netstandard2.0\" />
</files>
</package>
由于我的应用程序是“ netcoreapp2.2”应用程序,因此我希望它很高兴引用“ netstandard2.0”程序包,但出现此错误:
Package MyPackage 1.0.20191009.9 is not compatible with netcoreapp2.2 (.NETCoreApp,Version=v2.2). Package MyPackage 1.0.20191009.9 supports:
[15:37:55][restore] - net40 (.NETFramework,Version=v4.0)
[15:37:55][restore] - netstandard2.0 (.NETStandard,Version=v2.0)
我是否在nuspec中遗漏了一些东西以告诉它该netstandard2.0软件包与netcoreapp2.2兼容?