문제

I have a project that I need to deploy with a couple of different configurations (specifically, deploying the same package to 2 different IIS applications). I have set up 2 Publish Profiles, and each creates a package when invoked individually. I'd like to create both packages with a single command.

I've tried commands like this, but they tend to simply ignore the second profile:

msbuild MyWebProject.csproj /p:DeployOnBuild=True "/p:PublishProfile=FirstProfile;PublishProfile=SecondProfile"

Is there a way that I can use a single command to deploy both profiles?

도움이 되었습니까?

해결책

I know this isn't strictly what you are asking for, but have you considered building once and deploying twice?

To achieve this through msbuild, you could create an msbuild project which calls msdeploy.

Build (Create Package)

msbuild MyWebProject.csproj
    /p:DeployTarget=Package
    /p:PackageLocation=MyWebProject.zip
    /p:CreatePackageOnPublish=True

Deploy Package Twice

msdeploy.exe 
    -verb:sync 
    -source:Package=MyWebProject.Zip 
    -destination:auto:ComputerName="my.server1.com"
    -declareParamFile:Params1.xml

msdeploy.exe 
    -verb:sync 
    -source:Package=MyWebProject.Zip 
    -destination:auto:ComputerName="my.server2.com"
    -declareParamFile:Params2.xml
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top