Question

I have a transform for my web.config that currently works if I publish to Azure, but it's not working locally when I build/run. How can I go about "Publishing" locally so the Local transformations are applied to my web.config on my dev box?

Currently I right-click > publish to Azure, do I need to create a new publish profile for my local box? Is there any way to get the transforms to work on Build instead?

Was it helpful?

Solution

It depends on which dev server you are using. As @Citronas said on this answer:

It depends on how you debug. If you are using Cassini, afaik your web.config contents will be read regardless of the selected solution configuration (e.g. Debug or Release).

If you are debugging with your local IIS, it depends on what you have set the path in the IIS to. If you have set it to your source code directory, you need to write your local settings into your web.config. If you publish your code into a local directory and set the IIS path accordingly, you can use web.config transforms. (You said, that your web.config transforms are working)

You do not need to publish locally (even though you can do that, publish to local IIS then attach the debugger to the worker process of the application pool) since it is annoying. The easiest way is to simple have your debug settings in the web.config file and then apply transforms for your "publishable" environments.

In short: do not use transforms for debug, only for publishing. Use the regular web.config to debug.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top