Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. # IT:AD:XDT # <callout type="Navigation" class="small"> * [[../|(UP)]] {{indexmenu>.#2|nsort tsort}} </callout> <panel title="Summary"> XDT's are transformations processed at packaging time. They depend on the current `Build` configuration. * [Ref:CP](http://www.codeproject.com/Articles/399002/Project-Build-Web-config-transformation) * [SlowCheetah](http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5) </panel> ### Creating Web Config Transformations (XDT) Files ### See: [[IT/AD/XDT/HowTo/Generate XDT Documents]] Common Syntax is: <sxh xml> <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> <appSettings> <add key="UseSSL" value="false" xdt:Locator="Match(key)" xdt:Transform="SetAttributes"/> <add key="UseCaching" value="false" xdt:Locator="Match(key)" xdt:Transform="SetAttributes"/> <add key="CertificateStoreName" value="29c4f8fe8c7c353c09da646b7562b4bdd2009b38" xdt:Locator="Match(key)" xdt:Transform="SetAttributes"/> </appSettings> <connectionStrings> <add name="ICS-Database" connectionString="server=258SPIKES;database=SNZ.ICS.ST;Integrated Security=SSPI;" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/> </connectionStrings> <system.web> <customErrors mode="Off" xdt:Transform="SetAttributes" /> <compilation debug="true" xdt:Transform="SetAttributes" /> </system.web> </configuration> </sxh> ## Transformation ## Transformation happens when you right-click a Project, and `Build Package`. Depending on the current build (Debug,Release,ST, etc.) the transformation will occur, and be result be put in the package outout directory -- the default being: ../obj/Debug/Package/... Transformation can also be done from the CommandLine (see [[IT/AD/ALM/CI/]]: MSBuild {ProjName}.csproj /t:TransformWebConfig /p:Configuration=Release ## Tools ## >Scott Guthrie: *"In most real-world deployment scenarios, the web.config file you use for development is different than the one you use for production deployment. Typically you want to change environment settings like database connection-strings, making sure debug is turned off, and enabling custom errors so that end-users (and hackers) don’t see the internals of your application."* But the chief problem of this feature - is working only with web.config files. Config Transformation Tool gives opportunity to use XDT Transformation Syntax like at Deployment Web Application Project for any files. This tool is very easy, it just run msbuild task, which do this transformation. You just need to set source file, transformation file and destination file at arguments and run this tool. You can use it for app.config files for WinForms, WPF or Console projects and any other files. You can set this transformation task with nAnt or just set it in Post-Build Event for Project. >Note: MSBuild is distributed with .NET framework, so is available from the installer (ie WiX) or a BAT file, using a template. #### References #### * [http://ctt.codeplex.com/](http://ctt.codeplex.com/) * [http://transformconfig.codeplex.com/](http://transformconfig.codeplex.com/) /home/skysigal/public_html/data/pages/it/ad/xdt/home.txt Last modified: 2023/11/04 03:33by 127.0.0.1