我想打包一个动态链接库,这是只可用于x86和x64视窗,因为它PInvokes到一个本机动态链接库。
我有这个nuspec文件:
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<releaseNotes>First Nuget release</releaseNotes>
<copyright>$copyright$</copyright>
<tags>native ugly stuff</tags>
</metadata>
<files>
<file src="bin\Release" exclude="*.dll" />
<file src="bin\x86\Release\**" target="runtimes/win-x86/lib/net461" />
<file src="bin\x64\Release\**" target="runtimes/win-x64/lib/net461" />
</files>
</package>但是,在运行nuget pack -Properties Configuration=Release -NoDefaultExcludes时,AnyCPU变体仍然驻留在生成的包中。
如果我完全删除AnyCPU构建目标,我会得到这个错误:
Error NU5012: Unable to find 'C:\Users\RabJen\Documents\git\MySolution\MyNativeDLL\bin\Release\MynativeDLL.dll'. Make sure the project has been built.我遗漏了什么?
发布于 2019-04-15 21:51:35
当您不向nuget pack传递文件名时,它将查找任何MSBuild项目文件(如csproj),构建它,并包含输出程序集。我没有看到任何不包含项目输出的options。
因此,您的最佳选择是显式地告诉nuget pack nuspec文件,例如nuget pack whatever.nuspec。这意味着您的构建脚本将需要在打包之前构建项目,因为NuGet将不再构建您的项目,并且您还需要用实际值替换所有变量(由$包围的所有变量)。
https://stackoverflow.com/questions/55689371
复制相似问题