Nuget pack始终使用发布文件夹

Nuget pack始终使用发布文件夹,nuget,Nuget,我正在尝试为特定的构建配置创建一个nuget包。让我们以调试为例。我运行命令: nuget pack path_to_my.nuspec-Properties“Configuration=Debug;”-Verbosity Detailed 它向我抛出以下错误: 正在尝试从“path_到_my.nuspec”生成包。 System.IO.FileNotFoundException:未找到文件:“bin\Release\mydll.dll” 如您所见,它尝试从bin\Release而不是bin\D

我正在尝试为特定的构建配置创建一个nuget包。让我们以调试为例。我运行命令:

nuget pack path_to_my.nuspec-Properties“Configuration=Debug;”-Verbosity Detailed

它向我抛出以下错误:

正在尝试从“path_到_my.nuspec”生成包。 System.IO.FileNotFoundException:未找到文件:“bin\Release\mydll.dll”

如您所见,它尝试从bin\Release而不是bin\Debug获取dll


是否可以告诉nuget使用与Release不同的配置,或者使用另一个路径?

如果您已将发布路径硬编码到
bin\Release\mydll.dll
,则有必要检查您的nuspec文件,这似乎是事实

有效的nuspec文件将引用dll而不指定环境。使用通配符以允许任何环境。例如:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
    <id>MyProject</id>
    <authors>iberodev</authors>
    <version>1.0.0</version>
    <projectUrl>https://www.diegodrivendesign.com/</projectUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Sample</description>
  </metadata>
  <files>
    <file src="bin\*\netstandard2.0/ProjectOne.dll" target="lib\netstandard2.0" />
    <file src="bin\*\netstandard2.0/ProjectOne.pdb" target="lib\netstandard2.0" />
    <file src="bin\*\netstandard2.0/ProjectTwo.pdb" target="lib\netstandard2.0" />
    <file src="bin\*\netstandard2.0/ProjectTwo.pdb" target="lib\netstandard2.0" />
  </files>
</package>

您正在使用Windows Powershell吗?您是否安装了协同应用工具?我这样问是因为我做了一个
,当我做一个
哪个nuget
时,这个nuget可执行文件比较旧,这给我带来了麻烦。您正在运行哪个版本?@matap非常有兴趣了解此问题的更多细节,并找到适合您的解决方案。如果可能的话,请您在上提交一个bug,并提供所有相关的详细信息(nuget.exe版本,您正在使用的确切命令行)以及一个repo项目?谢谢你能展示一下你的nuspec吗?
nuget pack ./*NuGet/*.nuspec -Version 1.0.0 -OutputDirectory foo -Prop Configuration=Debug -Verbosity detailed