MSBuild Property Scope

前端 未结 2 1184
借酒劲吻你
借酒劲吻你 2020-12-29 05:58

Once again I\'m battling MSBuild. I want to have a property value defined with a root path. As part of the build, the path will get updated with version information. Howe

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-29 06:13

    Building on sll's answer, making the target that sets the new path a dependency instead of using CallTarget will yield the expected behaviour:

    
    
    
      
        \\server\folder
      
    
      
        
        
        
      
    
      
        
          $(MyPath)\version5
        
      
    
      
        
      
    
    
    

    Build Output:

    Main:
      In Main Before - MyPath = \\server\folder\version5
    Task1:
      In Task1 - MyPath = \\server\folder\version5
    Main:
      In Main After - MyPath = \\server\folder\version5
    

    Making SetMyPathProperty a dependency of Task1 instead of Main will result in identical behaviour to your PropertyScopeTest1.proj.

提交回复
热议问题