Take the 2-minute tour ×

Can someone please confirm or deny my assumption below and/or offer any alternatives?

My Goal

I'd like to be able to precompile and merge my ASP.NET MVC 4 application (as documented here and here) when one-click publishing to our production environment.

The Symptom

I've got an ASP.NET MVC 4 project in Visual Studio 2012. My Web.config contains various entries that are removed in the Web.Release.config transformation. One of the removed entries is the entire configSections element because we maintain those entries in the production server's Machine.config.

However, when I configure my project to precompile and merge for release publication, I get the following error:

Unrecognized configuration section [our custom section name]

My Assumption

What I assume is happening is that it is precompiling everything locally before publishing to the production server (which makes perfect sense) but that part of that precompilation process is to resolve and validate the entire .config chain, from the project's Web.config up to my local Machine.config (which doesn't make much sense, practically). And since my local Machine.config does not declare configSections (or any of the other settings we rely on the production server's Machine.config for), the resolved Web.config doesn't validate.

And since the Web.config doesn't validate, the site can't be precompiled and so nothing is ever published to production.

The Rub

If that is indeed what's happening, then we won't be able to precompile, because the only solution I can think of (other than some potential configuration option I haven't been able to find) would be for all of our developers to have local copies of our production server's Machine.config on their machines. And that simply isn't reasonable because it defeats the whole purpose of having those common settings declared in a single location.

share|improve this question

Your Answer



Browse other questions tagged or ask your own question.