Can I use Web Config Transform when publishing to

2020-07-10 06:21发布

问题:

I have three enviroments for my asp .Net mvc application Local, Development and production. This means i need three webconfig files. The transformation seems to work fine with local and development deployment through a build server but not when deploying to production. It works when i manually publish the site from visual studio 2012.

Does it have something to do with the servicConfigurations for the different enviroments?

回答1:

If you're going to Azure, then you can use publishing profiles. The trick is to chain your config files with your environment settings in Visual Studio.

There's an overview of publishing profiles here: http://msdn.microsoft.com/en-us/library/ff398069.aspx

And Scott Hanselman walks through a number of scenarios with chained config files here: http://www.hanselman.com/blog/TinyHappyFeatures3PublishingImprovementsChainedConfigTransformsAndDeployingASPNETAppsFromTheCommandLine.aspx

With those two pieces, there is enough info there to not only manually get the configs transforming, but also to work those into CI.

Hope this helps, cheers.