Web.config transformation option is greyed out

前端 未结 10 1077
刺人心
刺人心 2021-02-04 23:32

In VS2010, when I right click on my web.config file the \"Add Config Transforms\" option is greyed out.

Any idea how I can get that back?

相关标签:
10条回答
  • 2021-02-04 23:41

    If you want to really see the "Add Config Transforms" enabled , then add a new configuration using the configurationManager. Or delete any of the configuration file web.release.config or web.Debug.config. This is Visual Studio restriction to have a single config file for each environment.

    0 讨论(0)
  • 2021-02-04 23:42

    What worked for me is right clicking on the Publish profile and selecting "Add Config Transform", I then copied the existing code we had for transforms for QA, UAT, Production etc.

    0 讨论(0)
  • 2021-02-04 23:42

    I had the same problem. My solution was to install SlowCheetah to add another config transformation. Strange, but it works very well.

    0 讨论(0)
  • 2021-02-04 23:43

    It was greyed out because there were already transforms for all of the listed configurations.

    I couldn't see the transform files because vb.net in its infinite wisdom decided not to natively show the associated config files. Apparently there is no choice but to select "show all files" in order to see them.

    0 讨论(0)
  • 2021-02-04 23:43

    We have a solution with 140+ projects and over 13 different configurations, besides the default Debug and Release configurations. I ran into the same problem with one of my projects in that solution. The Add Config Transforms item was grayed out, yet I only had the Debug and Release web.config transforms. I believe this was because the project was probably added to the solution after all the custom configurations were created.

    I went into the Configuration Manager and observed that the project didn't have all the other configurations available. I had to manually add each missing configuration by specifying and the name. Once that was done, the Add Config Transforms is available.

    0 讨论(0)
  • 2021-02-04 23:48

    I had the scenario where I had an existing configuration named "Dev". There was no Web.Dev.congig file under Web.config and the menu option to add was disabled.

    I removed the configuration and added it back again. Upon doing this it added a new Web.Dev.config file and enabled the menu option to "Add config transform". I suspect there was some confusion going on in the csproj file.

    It seems that some of this confusion has been cleared up in VS2015.

    0 讨论(0)
提交回复
热议问题