简体   繁体   中英

Perform a web.config transform before publishing with MSBuild

I am trying to do a web deploy publish using MS Build for two web applications for internal use and testing. I have set up different solution configurations for each of the environments that i want to publish to. IE DevA, DevB. I have updated all the web.configs to do the correct transformations. As a note, the transforms work when i do a right click publish through Visual Studio so I have ruled those out as the problem. My current bat file that I am running uses this command to do the work:

"C:\\Program Files (x86)\\MSBuild\\12.0\\Bin\\msbuild" project.csproj /t:Clean;Rebuild;Publish /p:DeployOnBuild=true;PublishProfile=DevB1_API;AllowUntrustedCertificate=True;username=username;password=password

When i run this command the publish works just fine. However, the web.config is not being transformed. Am i missing a msbuild parameter to force this to happen? Any Help would be appreciated! thanks.

Apparently, for the transform to be executed, you have to specify a build configuration using:

/p:Configuration=Release

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM