XDT configuration transformations in Rider

Rider 2017.3 EAP comes with support for Web.config and App.config transformations. These configuration transformations allow us to update certain settings in a Web.config or App.config file when packaging the application. For example, we may want to update the database connection string for a Release build, or update certain settings for a Debug build.

Using the context menu in Solution Explorer or in the editor, we can generate a configuration transform file for any of our solution’s configuration files. Optionally, we can nest the file under its parent configuration, too.
Add new XDT config transformation

Rider generates a sample configuration transform file with certain pointers to the XDT transformation syntax. We could write a transformation that updates a connection string, and removes the debug="true" attribute from our Web.config:

While these transformations should be run using MSBuild, for example when using WebDeploy, Rider provides support for previewing (and running) them in the IDE. This lets us validate the XDT transformation we are working on, without having to run a full build each time.

The configuration transformation preview shows in a diff viewer, so we can see exactly which elements or attributes will be updated:
Preview XDT config transformation in Rider

Note in earlier versions of Rider, XDT configuration transformations are available as a plugin.

Download Rider 2017.3 EAP and give it a try!

About Maarten Balliauw

Maarten Balliauw is a Developer Advocate at JetBrains, working on .NET tools and Space. He focuses on .NET, Azure, web technologies and application performance. Maarten is a frequent speaker at various national and international events. In his free time, he brews his own beer. Follow him on Twitter or check out his personal blog.
This entry was posted in How-To's and tagged , , , , . Bookmark the permalink.

13 Responses to XDT configuration transformations in Rider

  1. Kira says:

    Is that possible to use this transformation in core projects?
    I know, I should use json config file, but I just wonder if it is possible

  2. Ilya says:

    Just installed 2017.3 and does’t have such menu item. Why?

  3. Ilya says:

    I have created ASP.NET Web Application (net4.5) with Rider 2017.3 wizard, then click Web.config in Solution Explorer. There is no “Config Transformation” menu item.

  4. Orest says:

    Please advise how to deal with transformations of app.config file.
    In VS 2015/2017 it’s possible to implement with extension named Slowcheetah. Building sln file with such transformations in Rider is not successful. What should be done to fix the issue?

Leave a Reply

Your email address will not be published. Required fields are marked *