it:ad:xdt:home

IT:AD:XDT

See: IT:AD:XDT:HowTo:Generate XDT documents

Common Syntax is:

    <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>

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 CI:

MSBuild {ProjName}.csproj /t:TransformWebConfig /p:Configuration=Release
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:

M

SBuild is distributed with .NET framework, so is available from the installer (ie WiX) or a BAT file, using a template.

References

  • /home/skysigal/public_html/data/pages/it/ad/xdt/home.txt
  • Last modified: 2023/11/04 03:33
  • by 127.0.0.1