How can you add a transform in a visual studio web project?

201 views Asked by At

I've created a new ASP.NET web project, that doesn't have a *.csproj file, but rather needs a website.publishproj to be published. The default project has a Web.Debug.config file that can be used for transforms.

How can I create a Web.Release.config, assuming I created a Configuration for it already?
Note: When I try to do it manually, it fails to get indented, and more importantly it fails to transform.

enter image description here

1

There are 1 answers

1
Igor On

You mean ASP.NET web site and not project. The web site is the one without the .csproj file, csproj stands for c sharp project.

I have played around with this and it is not possible. There is no configuration on this in the solution and no project file (csproj) that contains meta data on the file structure including how files should be associated. The presentation in Visual Studio for a web site "project" (here I mean project as in a node under the solution) simply lists all the content (files) in a specific folder. If you were to add a new file in the folder from the File Explorer and then hit refresh it would be added to the list. Similarly if you delete the Web.Debug.config file and hit refresh it is removed but after you add it again manually using File Explorer and hit Refresh in the project it will be re-added but again as a "child" of Web.config. This is likely because it does not appear to be possible to specify a different build configuration in the solution for a web site other than debug and there is no way I can see adding a configuration to a web site as there is no meta-data for the site.

So I am afraid that this presentation is not possible in a web site in Visual Studio. It could be accomplished by using a web project (with .csrproj) but that is not what you asked for.