I have three publish profile on my ASP.NET MVC project.
I need to add transformations for all of them. For doing that, I picked "Add Config Transform" on web.config file and got 4 web configs:
But I can't understand how can I assign any of them to any publish profile. For example, I can't find the right config file for put transformation for development publish profile. How can I do that ? Thanks for any advice.
I've created a new web config which I named "Web.development.config". That's my project file code for transformations:
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="AfterCompile" Condition="exists('Web.$(Configuration).config')">
<!-- Generate transformed app config in the intermediate directory -->
<TransformXml Source="Web.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="Web.$(Configuration).config" />
<!-- Force build process to use the transformed configuration file from now on. -->
<ItemGroup>
<AppConfigWithTargetPath Remove="Web.config" />
<AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
<TargetPath>$(TargetFileName).config</TargetPath>
</AppConfigWithTargetPath>
</ItemGroup>
</Target>
So with this solution you can use Web.<your publish profile name>.config
When you want to create a publish profile, you see a dropdown list where you specify what mode it will be. Try to create a new publish profile and you will see.
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