使用 MSBuild 调用设置 AssemblyFileVersion?
我们有一个基于批处理的构建过程,并且我们仅使用 MSBuild 从 Visual Studio 编译我们的项目文件。我们还将 wix 集成到我们的构建过程中。为了设置软件的版本,我们在主构建脚本中指定了一些在构建过程中使用的环境变量。 我的问题是,我必须在程序集信息中设置程序集的文件版本(AssemblyFileVersion)。 有没有办法为 MSBuild 调用提供一个要设置版本的属性?像这样(这不起作用):
%dotnetdir%msbuild.exe Viewer.csproj /property:Configuration=Release /property:Platform=AnyCPU /property:AssemblyFileVersion=%major%.%minor%.%build%
生成的程序集应具有文件版本 %major%.%minor%.%build%
。 在所有项目中设置 AssemblyFileVersion 设置对我来说很痛苦。这样做的程序违背了我的理念(我不想通过自动化流程更改我的源代码)。版本应通过构建脚本设置。没有必要在 AssemblyInfo.cs 中设置 AssemblyFileVersion
或者 MSBuild 是否可以指定描述程序集信息的 xml 配置文件?
如果有任何建议那就太好了。
问候,谢谢, 马丁
We have a batch-based buildprocess and we are using MSBuild only for compiling our project-files from visual studio. We also have integrated wix into our build-process. To set the version of our software we specify in the main-build-script some environment variables, that we use during the build-process.
My problem is, that i have to set the FileVersion of the Assembly (AssemblyFileVersion) in my assembly-informations.
Is there a way to give the MSBuild-call a property with the version to set? Like this (this doesn't work):
%dotnetdir%msbuild.exe Viewer.csproj /property:Configuration=Release /property:Platform=AnyCPU /property:AssemblyFileVersion=%major%.%minor%.%build%
The resulting assembly should have the fileversion %major%.%minor%.%build%
.
It's pain for me to set the AssemblyFileVersion-setting in all projects. And a program which is doing this is against my philosphy (i don't want to change my source with automated processes). The version should be set through the build-script. It is not necessary that the AssemblyFileVersion is set in the AssemblyInfo.cs
Or is there a possibility with MSBuild to specify a xml-configuration-file which describes the assembly-informations?
Would be great if there are any advices.
greetings, thanks,
Martin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MSBuild 社区任务Version 和
AssemblyInfo
任务a> 项目可能会有所帮助。The
Version
andAssemblyInfo
tasks from the MSBuild Community Tasks project may help.