How to exclude web.config when publishing with Visual Web Developer Express?
Asked Answered
E

1

37

When using the project publish feature in Visual Web Developer Express Edition 2008. How can you exclude publishing the web.config so that it doesn't overwrite the server web.config?

I've tried setting the following in the web.config, which works for any other files ending .config but not the web.config for some reason.

<buildProviders>
  <remove extension=".config" />
  <add extension=".config" type="System.Web.Compilation.IgnoreFileBuildProvider"/>
</buildProviders>
Edmondo answered 17/8, 2009 at 16:6 Comment(0)
E
75

I can't believe this is so simple but never got answered. I found the answer in this question

Simply select the web.config properties and change 'Build Action' to 'None' and 'Copy To Output Directory' to 'Do Not copy'

Edmondo answered 20/8, 2009 at 14:59 Comment(4)
In Visual Studio 2012, this didn't work. The solution below worked for me. blogs.msdn.com/b/webdev/archive/2010/04/22/… I have added <ExcludeFilesFromDeployment>*.config</ExcludeFilesFromDeployment> to the each of configuration (Release, Debug).Steerageway
@İbrahimULUDAĞ I did that and on publishing was facing missing/erroneous assembly problemsContravene
Me too. Adding webconfig to exclusion causes compile problems.Webber
Make sure in your publish settings you haven't ticked "delete the entire Internet before uploading my site".Withdrew

© 2022 - 2024 — McMap. All rights reserved.