How can I change AssemblyProduct, AssemblyTitle using MSBuild?

前端 未结 3 1818
独厮守ぢ
独厮守ぢ 2020-12-01 02:53

I have an MSBuild script which compiles my existing solution but I\'d like to change some properties of one of the projects within the solution at compile-time, inc

3条回答
  •  醉酒成梦
    2020-12-01 03:32

    Sneal's answer was very helpful, but I'd like to show what I actually ended up doing. Instead of editing csproj files (there are several) I instead added tasks to my build script. Here's a snippet:

          
            MyApp
            MyCompany
            1
            0
            0
            0
         
    
        
            
        
    
    
            
            
                
            
        
    
     
          
     
    

    Then, I can override my variables from the command line, or a batch script, like so:

    set MAJ=1
    set MIN=2
    set BLD=3
    set REV=4
    
    msbuild buildScript.xml /t:Compile /p:Major=%MAJ% /p:Minor=%MIN% /p:Build=%BLD% /p:Revision=%REV%
    

提交回复
热议问题