Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio not running correctly transformed config file

My approach here may be wrong, so apologies if so - I'd appreciate any advice on what I did wrong.

I need to run (locally, for debugging), a specific configuration of a project that contains specific web.config transforms.

In my solution, in Configuration Manager I have the following listed:

  • Debug
  • Release
  • ClientFoo (copied from Release)
  • ClientBar (copied from Release)

I created a new entry, ClientXYZ (copied from Debug), then right-clicked web.config and chose Add Config Transform. I applied the transform rules, and when previewed, the transforms display correctly.

When I select ClientXYZ in the solution config drop down, and start the debugger...

enter image description here

...I see that the web.config used to initiate the application is the Debug one, and not my new ClientXYZ version.

Is it possible to run the project locally with web.config transforms applied, for debugging?

like image 891
EvilDr Avatar asked Sep 03 '25 14:09

EvilDr


1 Answers

Web config transforms are only applied during publishing or building deployment packages by default (it does, after all, overwrite web.config). There is a way with some adjustments, however, described in this answer: https://stackoverflow.com/a/35561167/1464084

like image 63
Moho Avatar answered Sep 05 '25 07:09

Moho