简体   繁体   中英

Can you get Target Environment web.config transforms when packaging an Azure Web Role?

I'm quite used to publishing websites to IIS and Azure using the publish profiles feature of Visual Studio 2012. A big feature for me is the ability to specify a configuration transform file per environment, such that I can apply both the "Release" config transform and the "Production" config transform to produce a single result which is a release build tailored for he the production environment.

Now I'm trying to build an Azure worker role, which supports the idea of multiple discrete configurations for the role and will apply the "Release" or "Debug" build configuration transforms depending on the packaging settings.

Is it possible to also apply a target environment config transform to the web.config in a similar fashion to how publishing works?

To clarify, I want to apply multiple config transforms to the web.config of the web application hosted in the Web Role based on the build configuration and target environment.

Have a look at my answer here: Azure Web Role configuration settings across environments

The best solution I've found is to keep your web.config transforms for (Debug/Release).

Then separately, to keep individual Cloud Deployment Projects for each target environment you are going to deploy to (eg LocalEmulator, QA, Production).

It is possible to have CloudDeployment level config transforms, (ie on the ServiceConfiguration.cscfg) but you can only have a single Service Definition per Cloud Deployment. ( see note below ). So if you end up in a situation where you need different scaling, instance or endpoint options for different environments, this option falls down. The best solution I've found is one cloud deployment project per environment.

note It might/would be possible to build a config transform system for the csdef file as well using something CTT.exe or SlowCheetah but honestly this was more work than was required for my needs.

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