Msbuild TransformWebConfig Task - not working for App.configs?

I have a windows service that should have the same conversions that will be used in web.configs, but VS 2010 does not seem to support this. I tried to manually add the App.Release.Config files, and then use msbuil [PROJ] / T: TransformWebConfig / p: Configuration = Release, but no conversion is performed. I got the TransformWebConfig folder created in my obj subdirectory, but that.

Is this thing hard-coded for web.configs only?

+4
source share
3 answers

Yes, the TransformWebConfig task is designed to work with web.config (File: $ (MSBuildExtensionsPath32) \ Microsoft \ VisualStudio \ v10.0 \ Web \ Microsoft.Web.Publishing.targets Line: 199)

But you can make it work:

  • Customizing the Build Actions of your App.config File to Content

  • Setting the value of ProjectConfigFileName to App.config :

msbuild $ ProjectFile $ / t: TransformWebConfig / p: ProjectConfigFileName = App.config; Configuration = Relay

+1
source

I had the same problem and stumbled upon an article that details how to convert the app.config files:

http://vishaljoshi.blogspot.com/2010/05/applying-xdt-magic-to-appconfig.html

I went through the steps and was able to successfully convert the app.config file.

+1
source

Now you can use a plugin called SlowCheetah to convert not only app.configs, but also any xml files using the same conversion mechanism

+1
source

Source: https://habr.com/ru/post/1309034/


All Articles