Skip to content
This repository has been archived by the owner on Apr 11, 2020. It is now read-only.

Add support for xdt (web.config) transforms #252

Open
sayedihashimi opened this issue Oct 29, 2015 · 5 comments
Open

Add support for xdt (web.config) transforms #252

sayedihashimi opened this issue Oct 29, 2015 · 5 comments

Comments

@sayedihashimi
Copy link
Contributor

sayedihashimi commented Oct 29, 2015

Originally posted by @Schlurcher at aspnet/vsweb-publish#26

Hi there, this is probably more a question than an issue.

I'm currently publishing to my own machine using Web Publish. This machine hosts both staging and production environments. Which means both share the same ASPNET_ENV variable and this causes a bit of friction during deployment. I have to manually change the environmentVariable of the httpPlatform according to the deployment target.

What I would much prefer were the ability to use web.config transforms to transform the wwwroot/web.config during publish, for the sole purpose of setting ASPNET_ENV depending on the publish profile.

Is it currently possible to run transforms during publish, or was this ability deemed unnecessary for the new publish process?

@sayedihashimi
Copy link
Contributor Author

Hi @Schlurcher thanks for the note. I've move the issue here because this repo is monitored better. I think I'll close issues in the vsweb-publish repository.

I like this idea and if we implement it I think we should do that in a generic fashion.

So one question. In ASP.NET 4 web.config transforms are tied to the build configuration. So when you add web.config transforms then web.{BuildConfig}.config is created. For ASP.NET 5 we technically have a build configuration in VS, but the concept doesn't really flow to the underlying layers. In ASP.NET 5 we do have the concept of Environment though. So I'm wondering if we should support something related to that.

The idea is that when you right click on web.config (or any other xml file) when you pick Add Transform we will create web.production.config. We will aslo add a new property TargetEnvName to the publish profiles. So when you publish the file will be transformed using web.production.config and then web.{ProfileName}.config if it exists.

Note: the text above only states web.config but the support should work for any xml file.

Thoughts?

@Schlurcher
Copy link

Hi, sorry for answering so late.
I like it, definitely feels more natural to use the environment for the transformation. And if I'm understanding this right you still have the option of manually adding a web.{PublishProfile}.config, in case you really need it?

@sayedihashimi
Copy link
Contributor Author

TFS: 162788
I've added this to our internal TFS, we will reply back here soon.

@nil4
Copy link

nil4 commented Dec 26, 2016

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.

@webtools-bot
Copy link

The GitHub Issue Tracker for the aspnet/Tooling repo is being deprecated in favor of Visual Studio's Report a Problem tool.

If this issue is still a problem with the RTW release of Visual Studio 2017, please report a new issue using the Report a Problem tool. While you can still use .NET Core and ASP.NET Preview tools with Visual Studio 2015, Visual Studio 2017 is now the officially supported tool for developing .NET Core and ASP.NET Core projects.

By using the Report a Problem tool (available in both VS 2017 and VS 2015), you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks. See Visual Studio's Talk to Us page for more details.

Please use the discussion topic here for feedback and questions on the deprecation of this issue tracker. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants