asp.net config transforms - don't apply for normal builds, only publish
Asked Answered
S

1

6

We have a number of config transforms which enable us to publish to a particular environment with the correct options specified in web.config.

However, it would be useful to run the application locally while specifying a particular build configuration. This would enable us to run the app locally and have it connected to the live database, for example - quite handy when tracking down bugs, for example.

However, when we press F5 to run the app locally, regardless of the build configuration currently selected, no transform of the web.config file appears to occur.

Is this the normal behaviour and is it possible to change it?

Steer answered 1/7, 2011 at 13:53 Comment(4)
Yes, it is the normal behaviour. It's a nuisance because it makes the whole thing feel half-a-job-ish and I agree there should be the option to opt-in for the same transformations being applied during a standard build. I haven't found any VS extensions that can do this for you yet, though I imagine it could be done. I personally make a ".Local" version of all my build configs and publish to a local IIS which I can attach to very quickly/easily if I want to use a diffferent environment/config's web.config. Requires some duplication, but does the job.Psychoneurotic
This looks like the answer to me Smudge! If you repost it as an answer, I'll mark it. Thanks.Steer
Cheers @David, Posted as answer. Sorry it's probably not what you're after though.Psychoneurotic
It answered the question 'is it normal behaviour'. I know what to expect now!Steer
P
4

Reposted from comment:

Yes, it is the normal behaviour. It's a nuisance because it makes the whole thing feel half-a-job-ish and I agree there should be the option to opt-in for the same transformations being applied during a standard build. I haven't found any VS extensions that can do this for you yet, though I imagine it could be done. I personally make a ".Local" version of all my build configs and publish to a local IIS which I can attach to very quickly/easily if I want to use a diffferent environment/config's web.config. Requires some duplication, but does the job

Thanks David

Psychoneurotic answered 7/7, 2011 at 9:30 Comment(1)
I'm just following up wondering if you are still doing it the same way now that there are new Visual Studios. I am researching a solution regarding .targets files and WebConfigsToTransform.Uncommon

© 2022 - 2024 — McMap. All rights reserved.