我想在TeamCity构建服务器上自动生成nuget包 . 我们使用TeamCity AssemblyInfo Patcher使特定版本的所有dll具有相同的版本号 .
我们从项目中生成多个NuGet包 . 如何在依赖项字段中指定版本号,以便它使用与正在构建的包相同的编号 without hardcoding the number in the NuGet .spec file ?
例如, MyProject.Plugins
需要 MyProject.Math
. 因此,对于 MyProject.Plugins 1.2.3.45
,依赖项应如下所示:
<dependencies>
<dependency id="MyProject.Math" version="1.2.3.45" />
</dependencies>
1 回答
TeamCity的NuGet包包含版本号字段 .
如果您使用AssemblyInfoPatcher,我们可以使用我们在那里指定的数字 .
对于使用文件内容替换器的更复杂方法,从编译后的dll读取版本号的小型PowerShell脚本可以帮助并将其存储在teamcity配置参数%ActualVersion%中