Using robocopy with Visual Studio 2010 Post-build and Pre-build events

前端 未结 7 2055
忘了有多久
忘了有多久 2021-02-05 01:59

Robocopy outputs 1 upon success, unlike most programs that exit with 0 on success. Visual Studio (and MSBUILD) interprets exit code of 1 as an error.

How can Robocopy b

7条回答
  •  独厮守ぢ
    2021-02-05 02:34

    MSBuild extensionpack contains a Robocopy task that you can use in your build process.
    Can this be a solution for you instead of VS pre/postbuild events?

    If so, you can extend the Visual Studio Build Process by overriding the BeforeBuild, AfterBuild targets and calling the Robocopy task (you can override other targets as well if they would suit your needs better, see the list in the linked MSDN page)
    So actually you should download and install MSBuild extensionpack than open your project's csproj/vbproj file and edit the following way:

    Adding following entries for importing MSBuild extensionpack's Robocopy task

    
        $(MSBuildExtensionsPath32)\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks        
    
    
    

    Overriding BeforeBuild, AfterBuild and executing the Robocopy task

    
    
      
          
          
      
      
      
    
    
      
          
          
      
      
      
    
    

提交回复
热议问题