You can transform a config file by using the same objects the MSBuild task uses, bypassing MSBuild altogether. Web config transform logic is contained in the Microsoft.Web.Publishing. Tasks library The following code snippet comes from a simple class library, referencing the Microsoft.Web.Publishing.
Tasks library (which is installed on my machine at C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web) The sample loads a source document and transform, applies the transform, and writes the results to a new file using System; using Microsoft.Web.Publishing. Tasks; // ... var xmlTarget = new XmlTransformableDocument(); xmlTarget. PreserveWhitespace = true; xmlTarget.
Load("Web. Config"); var xmlTransform = new XmlTransformation("Web.Release. Config"); if (xmlTransform.
Apply(xmlTarget)) xmlTarget. Save("Web.Transformed. Config"); else Console.
WriteLine("Unable to apply transform. ") With a little creativity, this simple solution could be integrated into a Visual Studio plugin, perhaps as a context menu item on the web. Config file.At the very least, you can make a console utility or script out of it to generate previews Good luck!
You can transform a config file by using the same objects the MSBuild task uses, bypassing MSBuild altogether. Web config transform logic is contained in the Microsoft.Web.Publishing. Tasks library.
The following code snippet comes from a simple class library, referencing the Microsoft.Web.Publishing. Tasks library (which is installed on my machine at C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web). The sample loads a source document and transform, applies the transform, and writes the results to a new file.
Using System; using Microsoft.Web.Publishing. Tasks; // ... var xmlTarget = new XmlTransformableDocument(); xmlTarget. PreserveWhitespace = true; xmlTarget.
Load("Web. Config"); var xmlTransform = new XmlTransformation("Web.Release. Config"); if (xmlTransform.
Apply(xmlTarget)) xmlTarget. Save("Web.Transformed. Config"); else Console.
WriteLine("Unable to apply transform. "); With a little creativity, this simple solution could be integrated into a Visual Studio plugin, perhaps as a context menu item on the web. Config file.At the very least, you can make a console utility or script out of it to generate previews.
Good luck!
This is essentially an expansion of my "Edit 2" paragraph. I feel like there is at least some need for a tool like this and I starting to put the pieces together myself. With any luck I hope to release something on the Extension Gallery in the near future.
Thank you for the input! – Nathan Taylor Sep 29 '10 at 16:10 @Nathan: Good luck with the extension. I look forward to seeing it.
The CodePlex tool works by invoking MSBuild. For a custom tool you'll likely want to use the library directly as shown. Do me a favor and add a comment when you're finished.
Good luck! – kbrimington Sep 29 '10 at 18:33 I also initially thought it worked by invoking MSBuild, but after browsing the source I realized he is using the libraries you mentioned above. From the looks of it, it shouldn't be difficult at all to build a functional prototype of the extension.
– Nathan Taylor Sep 29 '10 at 23:07 @Nathan - Nice. Thanks for the follow-up. – kbrimington Sep 29 '10 at 12:29.
This VS add-in allows you to previous the transforms, the SlowCheetah VS add-in at ... visualstudiogallery.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.