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!
The xdt:Transform attribute value "SetAttributes" indicates that the purpose of this transform is to change attribute values of an existing element in the Web. config file.
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).
config file is located in the %SystemRoot%\Microsoft.NET\Framework\%VersionNumber%\CONFIG\ folder.
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 love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With