Setting AssemblyFileVersion with MSBuild-call?

一曲冷凌霜 提交于 2019-12-22 05:26:11

问题


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


回答1:


The Version and AssemblyInfo tasks from the MSBuild Community Tasks project may help.



来源:https://stackoverflow.com/questions/1859328/setting-assemblyfileversion-with-msbuild-call

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!