【发布时间】:2012-05-29 09:29:21
【问题描述】:
我正在尝试通过 here 解释的 Visual Studio 构建过程创建/推送 nuget 包。
构建包很简单:
<Exec WorkingDirectory="$(ProjectDir)" Command="$(NuGetApp) pack $(ProjectFile) -OutputDirectory $(Deploy) -Verbose -Prop Configuration=Release"/>
我在 $(Deploy) 文件夹中看到 .nupkg 文件。
但是为了能够推送它,我需要 $(AssemblyVersion) 来使用它:
<Exec Command="$(NuGetApp) push $(ProjectName)$(AssemblyVersion) -s $(NugetServer) $(NugetKey)" />
我尝试 XMLRead 来获取值,但 NugetSpecFile 中的值是“$version$”,而不是 AssemblyInfo.cs 中的版本。
<XmlRead XPath="/package/metadata/version" XmlFileName="$(NuSpecFile)">
<Output TaskParameter="Value" PropertyName="AssemblyVersion" />
</XmlRead>
如何访问版本以便在“nuget push”中使用它?
【问题讨论】:
标签: msbuild nuget-package assemblyinfo