3

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?

EvilDr
  • 8,943
  • 14
  • 73
  • 133

2 Answers2

2

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

Moho
  • 15,457
  • 1
  • 30
  • 31
  • After reading this, I realise my question is actually a duplicate. What is the purpose therefore of those dropdown lists in Visual Studio that I provided a screen grab of? – EvilDr Sep 28 '17 at 09:51
0

The purpose of using "Debug" and "Release" in Visual Studio are:

  • Debug constant defined in Debug configuration when you are developing application
  • Release optimize code enabled in Release configuration when you host that application for client side testing or publishing
  • Custom (ClientXYZ) constant defined for a developer's own settings (localhost or different IP's) for both Client site hosting and publishing your site
  • Yes, I realise this. But the problem is that `ClientXYZ` does not get applied, so when the code runs locally, Debug/Release is always the *actual* code that's running, and not my *ClientXYZ* version – EvilDr Oct 03 '17 at 08:48
  • No, because I am trying to run the ClientXYZ build. – EvilDr Oct 03 '17 at 09:03