56

I attempted to launch a website project locally but received the below message in an error dialog:

Please correct before proceeding.(You might rename the current web.config and add a new one).

Typically this error is preceded by a general description of the cause, this one was not. Knowing odd, out-of-the-blue, problems such as these are typically related to corrupt IDE generated files. I tried deleting the .suo, .vssscc and other generated files from the solution and project directories but the problem continued.

alan
  • 6,705
  • 9
  • 40
  • 70

12 Answers12

87

This happened to me today after getting latest. I resolved by closing and reopening the solution, rebuild, then run. All is well...

Kershaw
  • 1,124
  • 1
  • 7
  • 18
30

I actually resolved this by making sure the Web.config file wasn't an open document inside VS 2015. In other words, close the Web.config file wherever it might be open, and make sure your Team Explorer isn't causing any problems, like an unexpected change or staged change...rebuild the sln and run...

whyoz
  • 5,168
  • 47
  • 53
22

Close vs2017 and open it again worked for me

Ton
  • 316
  • 2
  • 12
15

just open web.config and run again.I've had this problem and I resolved by this solution .

Mohsen Zahedi
  • 651
  • 2
  • 10
  • 28
11

I fixed the problem using a solution I found for a different IDE-related issue (original answer here). Run the following in an elevated command prompt:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe" /setup

Note: You'll need to adjust the path for your version of Visual Studio (original version mapping answer here):

  • Visual Studio 2005 = 8
  • Visual Studio 2008 = 9.0
  • Visual Studio 2010 = 10.0
  • Visual Studio 2012 = 11.0
  • Visual Studio 2013 = 12.0
  • Visual Studio 2015 = 14.0
Community
  • 1
  • 1
alan
  • 6,705
  • 9
  • 40
  • 70
  • 3
    In the start menu, there is `Visual Studio 2015 -> Visual Studio Tools`. Open it and select `Developer Command Prompt for VS 2015`. This will open a console with the right entry directory, so you can type `devenv.exe /setup` directly. A similar entry exists for the older Visual Studio versions. – Matt Sep 26 '16 at 11:20
  • 1
    Maybe it's obvious, but I had to close Visual Studio before running an elevated Developer Command Prompt and once it was done start Visual Studio again. Running it while having Visual Studio 2019 open did not help. – Jonny Jul 07 '21 at 21:10
6

This issue came to me after merging some code in version control using RTC tools. When I saw whyoz answer I noticed that web.config wasn't opened anywhere. It could be RTC locking the file or something like this. So, I simply restarted Visual Studio and it became normal again.

Community
  • 1
  • 1
tgarcia
  • 675
  • 9
  • 21
3

I ran into this issue today after doing a branch merge using the VS19 built-in Git tools. The config file was correct; I even used a schema validator based on KD2ND's answer in how can I validate dot net application config file(ex, app.exe.config) on console?.

I cleaned the solution, unloaded it, and reloaded it, and everything worked fine. I didn't even need to restart studio.

Based on others' answers, this appears to be related to code merging in the IDE. It's a weird problem but it's a relief that the solution (once found) is simple.

EJSawyer
  • 409
  • 5
  • 5
3

As an FYI, in VS 2019 the solution is to close the tabs, and the solution and Visual Studio, then restart Visual Studio. This has worked for me.

Muniro
  • 1,989
  • 3
  • 11
  • 9
3

in Microsoft Visual Studio 2019 : Just neeed to close project, thenn open+ clean+rebuild and everything work

1

In VS 19 Enterprise, the Solution for me was:

"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\devenv.exe" /setup

Based on the merked answer from alan.

C. Fritz
  • 19
  • 1
  • 3
1

I had just opened the web.config file and then pressed CTRL K + D. it will make the formatting good of the file. and then run the application. it worked for me.

Even if you undo the above changes then also it works. it is weird somehow.

Vivek Nuna
  • 25,472
  • 25
  • 109
  • 197
1

I dont know how or why, but in my case, just opening the web.config file in visual studio , are solving my problem... if i close the web.config file in visual studio, the error message appears.

Renan Duarte
  • 138
  • 1
  • 10