-
Notifications
You must be signed in to change notification settings - Fork 58
Support XDT Web.config transforms when publishing #146
Comments
publish-iis tool and web.config are mainly IIS concepts. ASP.NET Core apps can run directly on Kestrel, or behind nginx too. You could write a tool (similar to publish-iis) to make web.config transformations that can run as part of your post-publish scripts. |
I will give it a try, using the code from https://git01.codeplex.com/xdt as a starting point. |
@nil4 It was a breeze using |
@guardrex thanks, that's pretty cool! My use case is a bit different though: we have multiple apps that each use slightly different IIS settings per-environment (e.g. URL rewrite rules, authentication configuration, request limits, etc.) We are comfortable using XDT transforms so I would prefer to have a general-purpose tool that can customize each app's Web.config at publish time. As a bonus, I hope to learn how to write (and test) a dotnet tool. |
It's a command line application, so you have a Therefore, all you need to do is pickup the environment however it makes sense for your process inside the This is a wonderful tooling system, and @moozzyk gets a BIG 👍 based on the quality work he put into that particular tool. In addition to being a great tool to help with I think you'll have a great time and have a low barrier for what you'd like to do. |
Well, it took a bit longer than expected, but I got the initial port working: GitHub repo and NuGet package. There are a few rough spots noted down as known issues (mainly diagnostics), but it's working well enough for my main use cases. Hopefully it will be useful for someone else too. Feedback is welcome! I did not manage to port the unit tests in the time I set aside for this, so that's still on the to-do list. |
@nil4 Why do you have the tool in both the tools section and dependencies section? Is it also used at runtime? |
@davidfowl good question! While I was developing locally, I used If I didn't add the package to the
Today I tested from another machine, one that does not have a local version of the package. It picked it up from NuGet and it worked as expected when installed just under the Back at home, I tried again. As soon as I add the local NuGet source I get the error above; when I use just nuget.org, everything works as expected. 😕 So I updated the readme file to reflect that only the |
A generic dotnet CLI tool for XDT transforms is available for both project.json-based and MSBuild/csproj-based projects that enables config transformations. A couple of sample projects demonstrating Web.config transformations at publish time are also available. |
I have a problem like that: The Visual Studio add automatically the nodes inside :
But my web.[debug or release].conf don't have this node. I remove the nodes of ApplicationInsights of web.config and resolve my problem. Thanks. |
Hi, it looks like you are posting on a closed issue/PR/commit! We're very likely to lose track of your bug/feedback/question unless you:
|
Application-specific configuration values that differ per-environment are supported well through the ASP.NET Core configuration system. For many applications, the IIS hosting configuration defined in
Web.config
also needs to be adapted to the target deployment environment (at a minimum, to distinguishing between development and production scenarios).ASP.NET tooling in Visual Studio historically supported XDT transforms that are applied at publish time, and the project templates include these by default. Furthermore, since ASP.NET Core moved the Web.config file to the project root folder, the VS 15 preview tooling automatically adds
Web.Debug.config
andWeb.Release.config
transforms. A request to support this feature is tracked at aspnet/Tooling#252.With the IIS publishing moving to this repo, I think XDT
Web.config
transforms at publish time should be considered here rather than in the VS tooling. Opening this issue for discussion and feedback.The text was updated successfully, but these errors were encountered: