Can multiple build configs share one config transformation?

北战南征 提交于 2019-12-05 11:17:22

The configuration transformations are handled by the $(Configuration) variable in the TransformsFiles.targets file.

 <TransformXml Source="@(_FilesToTransformNotAppConfig->'%(FullPath)')"
                  Transform="%(RelativeDir)%(Filename).$(Configuration)%(Extension)"
                  Destination="@(_FilesToTransformNotAppConfig->'$(OutDir)%(RelativeDir)%(Filename)%(Extension)')"
                  Condition=" Exists('%(RelativeDir)%(Filename).$(Configuration)%(Extension)') " />

Here, you can change $(Configuration) to be any other value, like "Environment". Then just set the "Environment" variable in your MSBuild args -

/p:Environment=Prod

This should allow you to keep your build settings and do your transforms independently.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!