Search code examples
asp.net-mvc-4nullreferenceexceptionpublishingvisual-studio-2012

Error when I click publish | "Object reference not set to an instance of an object"


I'm trying to publish the files of a project I just created in Visual Studio 2012.

When I click publish,

enter image description here

the following window is displayed

enter image description here

Already created a new web project (same type, asp.net mvc 4) and tried to make the same change and everything worked. Apparently this only occurs on this project!

Already closed the "VS" and opened again as I restarted the PC .. Any tips?


Solution

  • Do you have a <clear/> element in your <connectionStrings> element in your web.config? If so, delete it and you should be able to publish.