Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add files in web.config transformation process?

I am having a website developed in Visual Studio 2012. The web.config is currently containing following files in its transformation: - web.Debug.config - web.Release.config

I have recently added a new build configuration (named as "Staging") in my project. How can I create a "web.Staging.config" transformation file?

like image 524
Nirman Avatar asked Mar 21 '13 08:03

Nirman


People also ask

How does web config transform work?

A Web. config transformation file contains XML markup that specifies how to change the Web. config file when it is deployed. You can specify different changes for specific build configurations and for specific publish profiles.


3 Answers

There are two ways for the web.config transform files to be generated within VS:

  1. 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).
    • This method is not supported for Website projects as they do not support multiple build configurations.
  2. In either web project type, right click on a publish profile (.pubxml) and choose Add Config Transform. This will add a new config transform for that profile only.
    • This requires VS2012 Update 2 or the Azure SDK 2.0 for VS2010 (I think).
    • In a web site project, the new transform file will not be nested under web.config as VS doesn't support that behavior. Just look for it in the root folder.
like image 198
Jimmy Avatar answered Oct 05 '22 20:10

Jimmy


IN VS 2012:

  1. Go to Build->Configuration Manager
  2. Click on the Active solutions configuration and select "New".
  3. Enter the name of your new configuration and click Save.
  4. Right click on your Web.config file and select Add Config Transform.

Your new transform file will be automatically created.

like image 22
spadelives Avatar answered Oct 05 '22 22:10

spadelives


You need to first install the Configure Transform extension [Extensions -> Manage Extensions -> Online section] to see the option when right-clicking your web.{environment}.config files.

like image 21
silkfire Avatar answered Oct 05 '22 21:10

silkfire