Skip to content
This repository was archived by the owner on Feb 8, 2022. It is now read-only.
This repository was archived by the owner on Feb 8, 2022. It is now read-only.

Multiple Configuration Transforms Not Working #2

@MSWCRB

Description

@MSWCRB

There is a bug with the current implementation that was identified by Dan Bullock on 9/19/2017 wherein the extensions is created a new AfterBuild section in the project file for each config transform in a project, which causes only the first transform to be applied in a scenario where a project has more than one config file that needs to be transformed. Dan also presents the solution there. Please fix it if you have time.

"The sample project is not correct. The sample defines multiple <AfterBuild> but when it actually can only be defined once. Each definition replaces the previous.

In .csproj it should be a single AfterBuild with each TransformXml having a condition:

<Target Name="AfterBuild">
<!--Generate transformed config in the output directory-->
<TransformXml Condition="Exists('data.$(Configuration).config')" Source="data.config" Destination="$(OutputPath)data.config" Transform="data.$(Configuration).config" />
<TransformXml Condition="Exists('plainxml.$(Configuration).config')" Source="plainxml.config" Destination="$(OutputPath)plainxml.config" Transform="plainxml.$(Configuration).config" />
</Target>
By Dan Bullock 9/19/2017"

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions