Pre-build MSBuild task to update AssemblyInfo not in sync with built exe

后端 未结 4 1461
孤独总比滥情好
孤独总比滥情好 2020-12-05 04:54

I am using a pre-build task in Visual Studio 2008 that invokes msbuild:

C:\\WINDOWS\\Microsoft.NET\\Framework\\v3.5\\MSBuild.exe $(MSBuildProjectDirectory)\\         


        
4条回答
  •  盖世英雄少女心
    2020-12-05 05:43

    Interesting, I wrote my own custom task which is hooked into BeforeBuild and this is working fine. Never had a problem from VS or MSBuild via command line. So I would say explore BeforeBuild some more...

    I know because we use our build server (CruiseControl.NET) build number as the "Build" part of the version, which is built into all assemblies (we share the same AssemblyInfo.cs for AssemblyVersion and AssemblyFileVersion across assemblies in the solution) and this is then pushed (via FileUpdate task) to a variable in our WiX project and also used to label the MSI file name.

    
      
    
    
    
      
    
    

    If you do some googling you should find other examples...sorry I can't give you the UpdateVersion code, i'd need permission from my work, but if you can't find anything suitable on the net, custom tasks are easy to write and the above should help.

提交回复
热议问题