Jeff D
Jeff D

Reputation: 2175

msbuild TransformWebConfig task - doesn't work for App.configs?

I have a windows service that will need to have the same kind of transformations that the web.configs would use, but VS 2010 doesn't seem to support that. I've tried manually adding the App.Release.Config files, and then using msbuil [PROJ] /T:TransformWebConfig /p:Configuration=Release but no transformation is performed. I got a TransformWebConfig folder createed in my obj subdirectory, but that's it.

Is this thing hardcoded to only work with web.configs?

Upvotes: 4

Views: 4162

Answers (3)

Chris
Chris

Reputation: 12282

You can now use a plugin called SlowCheetah to transform not only app.configs but any xml files using the same transformation engine

Upvotes: 1

Jed
Jed

Reputation: 153

I was having the same issue and came across an article that details how to accomplish transforming app.config files:

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

I walked through the steps and was successfully able to transform my app.config file.

Upvotes: 1

Julien Hoarau
Julien Hoarau

Reputation: 49970

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

But you could make it work by :

  1. Setting the Build Action of your App.config file to Content

  2. Setting the value of ProjectConfigFileName to App.config :

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

Upvotes: 1

Related Questions