Web.config transformation option is greyed out

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?


Solution 1:

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.

Solution 2:

One can also avoid the configuration manager dialog entirely and just directly edit the project file, adding as many additional config files as needed.

This is especially useful when using a more advanced config transformation tool like CodeAssassin.ConfigTransform or SlowCheetah.

<ItemGroup>
    <Content Include="web.config">
        <SubType>Designer</SubType>
    </Content>
    <Content Include="web.debug.local.config">
        <DependentUpon>web.config</DependentUpon>
    </Content>
    <Content Include="web.debug.cloudstaging.config">
        <DependentUpon>web.config</DependentUpon>
    </Content>
    <Content Include="web.release.cloudprod.config">
        <DependentUpon>web.config</DependentUpon>
    </Content>
</ItemGroup>

Solution 3:

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.