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.
If you have a web application project, Right-click on web. config and choose Add Config Transform. This will add any config transforms that are missing from your project based on build configurations (i.e. if you have Production and Staging build configs, both will get a transform added).
XDT is a simple and straight forward method of transforming the web. config during publishing/packaging. Transformation actions are specified using XML attributes defined in the XML-Document-Transform namespace, that is mapped to the xdt prefix.
Bookmark this question. Show activity on this post. dotnet publish -c Release doesn't create this web. config , so I created itself and put it in the solution (odd, because I've never had to do this before).
Apparently, for the transform to be executed, you have to specify a build configuration using:
/p:Configuration=Release
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With