参考这个帖子:上一个问题
我已经尝试了所提出的各种解决方案,但“在 lib 文件夹外组装”错误仍然存在。
我在其他项目中使用了下面的 nuspec 文件格式,它工作正常,下面是我的 nuspec 文件:
<?xml version="1.0"?>
<package >
<metadata>
<id>Workflow.Assembly</id>
<version>1.0.0.0</version>
<title>Workflow.Assembly</title>
<authors>MyAuthor</authors>
<owners>MyOwner</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>My Description</description>
<releaseNotes>My Release notes</releaseNotes>
<copyright>Copyright 2016</copyright>
<tags>My Tags</tags>
</metadata>
</package>
Run Code Online (Sandbox Code Playgroud)
powershell 命令行:nuget spec MyProject.csproj(创建 nuspec 文件的 shell,编辑为与上面的示例类似)
nuget pack MyProject.csproj -InincludeReferencedProjects(输出示例)警告:在包“MyAssembly”中发现 11 个问题。
问题:lib 文件夹外的程序集。描述:程序集“content\lib\MyReferenced.dll”不在“lib”文件夹内,因此当包安装到项目中时,不会将其添加为引用。解决方案:如果需要引用,请将其移至“lib”文件夹中。
我已经尝试了上一个问题中提到的各种<files /> <dependency />修饰符组合,但仍然收到错误。
这个“lib”文件夹引用哪个文件夹,如何获得nuget期望依赖的dll所在的绝对路径(如果路径是它想要的)?
将“文件”部分添加到 nuspec,将项目的输出链接到“lib”文件夹。
<files>
<file src="bin\Release\MyAssembly.???" target="lib" />
</files>
Run Code Online (Sandbox Code Playgroud)
https://docs.nuget.org/create/nuspec-reference