为什么NuGet.exe打包忽略Configuration = Release参数?

时间:2018-03-02 17:12:00

标签: nuget

使用nuget.exe打包应用程序,我将Release指定为配置,但它失败并显示“确保已构建项目”。因为它正在查看Debug文件夹,而不是Release文件夹:

NuGet.exe pack "C:\dev\Test\WpfApp1.csproj" -OutputDirectory "C:\dev\a\packages\" -Properties Configuration=Release

Attempting to build package from 'WpfApp1.csproj'.

Unable to find 'C:\dev\Test\bin\Debug\WpfApp1.exe'. Make sure the project has been built.

为什么?

1 个答案:

答案 0 :(得分:3)

经过多次试验和错误,我发现了它。发现差异?:

NuGet.exe pack "C:\dev\Test\WpfApp1.csproj" -OutputDirectory "C:\dev\a\packages" -Properties Configuration=Release

Attempting to build package from 'WpfApp1.csproj'.

Packing files from 'C:\dev\Test\bin\Release'.

是的,OutputDirectory参数路径末尾的反斜杠导致它选择Debug而不是Release。难怪我花了4个小时从失败的TFS Nuget Packager步骤缩小范围。不好笑。