【发布时间】:2016-01-01 20:05:02
【问题描述】:
我正在尝试使用项目文件中的以下代码将 NuGet 生成过程添加为 C# 项目中的 AfterBuild 事件:
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release'">
<Message Text="**** Starting after-build process= ****" />
<Exec Command="nuget.exe update -self" />
<Copy SourceFiles="$(ProjectDir)bin\release\$(ProjectName).dll" DestinationFolder="$(SolutionDir)Nuget\$(ProjectName)\lib\Net45" />
<Delete Files="$(SolutionDir)Nuget\*.nupkg" />
<Exec Command="nuget.exe pack $(ProjectName).nuspec -Properties "Configuration=Release" -BasePath="$(SolutionDir)Nuget\$(ProjectName)" -OutputDirectory="$(SolutionDir)Nuget"" />
<Message Text="**** After-build process completed ****" />
</Target>
但我在构建输出窗格中收到一条消息:
Unknown option: '-BasePath="<the path shown in here>"
我使用的是 NuGet.exe 版本 3.3.0,并且我将 https://docs.nuget.org/consume/command-line-reference#pack-command 引用为我的“如何使用”信息。
为了查看 Visual Studio 2015 是否影响了某些东西,我尝试从构建输出窗格复制已执行的命令,插入正确的路径,然后在 VS 命令提示符下执行它。这失败了,同样的评论,所以它似乎是一个 NuGet 问题。
【问题讨论】:
标签: msbuild visual-studio-2015 nuget post-build-event