MsBuild and MsDeploy with multiple environments

前端 未结 2 1114
生来不讨喜
生来不讨喜 2021-01-30 04:36

Are there good patterns for mapping solution configurations to environments and using MsDeploy for packaging per environment?

Shortest version: Grab this file, and try t

2条回答
  •  时光说笑
    2021-01-30 04:46

    The first attempt failed because Package target doesn't exist in the solution file. When using MSBuild on a solution file, a temporary MSBuild project is created (SamplePackage.sln.metaproj); this project file contains only some targets (Build, Clean, Rebuild, Publish, ...)

    Solution : DeployOnBuild & DeployTarget properties

    One way to do what you want is to use DeployOnBuild property like this :

    
      Any Cpu
      Dev
      $(MSBuildProjectDirectory)\package.zip
    
    
    
      
    
    
    
      
    
    
    • DeployOnBuild=true : deployment must be made when Build is called
    • DeployTarget=Package : for deployment creates a package
    • PackageLocation : indicates the filepath of the package file

    Additional links :

    • Creating web packages using MSBuild
    • How can I get TFS2010 to run MSDEPLOY for me through MSBUILD?
    • How to "Package/Publish" Web Site project using VS2010 and MsBuild
    • Automated Deployment in ASP.NET 4 - Frequently Asked Questions

提交回复
热议问题