Here is the scenario: I have a website which has a web.config file along with many other environment specific config files like Web.Staging.config/Web.Release.config/Web.OnPrem.config Now, I have configured the BeforeBuild Target in the csproj file of my website project:
<Target Name="BeforeBuild">
<TransformXml Source="Web.config" Transform="Web.$(Configuration).config" Destination="Web.config" />
</Target>
This works well when I setup bamboo to build and create artifacts in Release mode (so the deployed application has the transformed web.config file from web.Release.config But, when I change the bamboo to build and create artifacts using OnPrem configuration, it does not transform the web.config file correctly.
When I say setup bamboo to build in OnPrem config, I have actually change the configuration option to below:
/p:Configuration=OnPrem
and also, I have changed the BambooBuild.proj to have
<ConfigurationToBuild Include="OnPrem|Any CPU">
<FlavorToBuild>OnPrem</FlavorToBuild>
<PlatformToBuild>Any CPU</PlatformToBuild>
</ConfigurationToBuild>
What am I missing here?