I am working in an ASP.net MVC 5 solution in Visual Studio 2015. I have the following web.config
How do I rename those to be
- Web.Integration.config
- Web.Staging.config
- Web.Production.config
When I right-click on those, I don't get a rename option!
I am working in an ASP.net MVC 5 solution in Visual Studio 2015. I have the following web.config
How do I rename those to be
When I right-click on those, I don't get a rename option!
You can copy the files, rename them and manually edit the .csproj file to include them (replacing the generated ones) like below:
<Content Include="Web.Integration.config">
<DependentUpon>Web.config</DependentUpon>
<SubType>Designer</SubType>
</Content>
<Content Include="Web.Staging.config">
<DependentUpon>Web.config</DependentUpon>
<SubType>Designer</SubType>
</Content>
<Content Include="Web.Production.config">
<DependentUpon>Web.config</DependentUpon>
<SubType>Designer</SubType>
</Content>
Unfortunatelly I did not find a way to acomplish this through visual studio.
This is the third time I've set one of these up in a project and I get stuck every time. The key is that the config transform files are linked to the named build configurations.
If you go to Build
> Configuration Manager...
and select the Active solution configuration
drop-down you can add new build names. Afterward you can right-click your web.config and Add Config Transform
, which asks no questions and just creates one transform for each build.
Renaming an existing build didn't work, it still generated a transform with the original name, but you can delete builds or selectively delete the transform files.
If you are using the extension Configuration Transform go to Build > Configuration Manager and find the Configuration dropdown for the project of which you want to change the app config. You can then select the edit and rename the build configurations for that project. Then re-run the Configuration Transform tool and it will generate app configs using the names you provided in the build configuration settings.
What I found worked for me is to just delete the Debug and Release, and then create new ones. Saved me a lot of worry with dangling references and build errors and the like