based on what i read, as long as you have a transform that matches the name of a publish profile, it should be applied, but this is not the case for me.
publish profiles
PublisProfiles
dev.pubxml
local.pubxml
transforms
Web.Config
Web.Debug.config
Web.local.config
Web.Release.config
when i publish using local config, i see this:
Transformed Web.config using C:\...\Web.Release.config into obj\Release\TransformWebConfig\transformed\Web.config.
so it's using Release.config .. i opened up local.pubxml and tried changing this
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
to:
<LastUsedBuildConfiguration>local</LastUsedBuildConfiguration>
but then it's using Web.Debug.config transform.
dev, release, local transforms are identical aside from a few transformed properties ..
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.
A Web. config transformation file contains XML markup that specifies how to change the Web. config file when it is deployed. You can specify different changes for specific build configurations and for specific publish profiles.
My problem with that had to do with the platform configuration:
At the Configuration Manager window, you can choose the config name ("Active solution configuration" combobox) and the target platform ("Active solution platform" combobox). I correctly made the setup of my new configuration ("MyStagingConfig", say) for each project, but forgot about the platform - so I configured it all in "Mixed platform".
When I published the project using "MyStagingConfig - Any CPU", it transformed the config with the Web.Staging.config
file, instead of Web.MyStagingConfig.config
. After a little headache, I realised that the "Any CPU" platform, which I hadn't configured, was configured by default to publish the project with the "Staging" config (as I had imported the settings from the "Staging" config when creating "MyStagingConfig").
The publish pipeline should be using both your profile's transform and the build configuration transform.
The logic for this is that your profile transform probably has destination-specific settings (e.g. which connection strings to use in Production vs. Staging), but your build configuration has build-specific settings (e.g. Debug has debugging related settings but Release turns them off). Allowing you to mix and match these gives greater flexibility (need to publish to Staging with debug settings enabled? Just use the Debug build configuration with the Staging profile). Settings from web.YourProfile.config will always overrule any prior transforms.
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