3

I realize that a billion people have asked about this error, but I've looked at all of them. Mine seems different. I'm not getting any sort of source code error, no stack trace, no helpful information whatsoever, because the error occurs immediately upon clicking "Publish" on my MVC.NET project. It's just a dialog box, and that's all it says. Nothing else happens.

Things that might be related:

  • I'm using Team Foundation. I had some trouble with it (user error) for a while, but I just got everything back to the way it should be (I think).
  • At one point I used an EDMX thing. I deleted in favor of making my table models from scratch.
  • I can't find my publishing profile anymore, nor can I figure out how to make a new one. I thought it was supposed to be in a ~/PublishProfiles folder. It's not there.

I know I haven't given a lot of information, but I don't even know where to begin. I'll be happy to provide anything else upon request. Thank you.

EDIT
I should note that it builds and runs perfectly on the localhost server.

EDIT 2
I rolled back to the oldest version on source control and it worked. I guess I can painstakingly go through each changeset. Also, I did find the PublishProfiles folder. I verified that no changes have been made to the profile.

Andrew
  • 4,145
  • 2
  • 37
  • 42

4 Answers4

8

I was wrong about there not being any changes to the publishing profile. Here is what happened.

I set up a code-first Entities context called, say, MyDBContext. In my publishing profile myprofile.pubxml, Some code automatically gets inserted like this:

<PublishDatabaseSettings>
  <Objects xmlns="">
    <ObjectGroup Name="MyDBContext" ......
<MSDeployParameterValue Include="$(DeployParameterPrefix)MyDBContext-Web.config Connection String" />

Then, I decide to try the EDMX stuff. But I save my old structure just in case. Now the File looks like this:

<PublishDatabaseSettings>
  <Objects xmlns="">
    <ObjectGroup Name="MyDBContext" Order="1" ......
    <ObjectGroup Name="myEntities" Order="2" ......
<MSDeployParameterValue Include="$(DeployParameterPrefix)MyDBContext-Web.config Connection String" />
<MSDeployParameterValue Include="$(DeployParameterPrefix)myEntities-Web.config Connection String" />

But then, I decide to ditch the EDMX stuff. Somehow, though, instead of removing the second set of entries in the .pubxml file, this happened:

<PublishDatabaseSettings>
  <Objects xmlns="">
    <ObjectGroup Name="MyDBContext" Order="1" ......
    <ObjectGroup Name="MyDBContext" Order="2" ......
<MSDeployParameterValue Include="$(DeployParameterPrefix)MyDBContext-Web.config Connection String" />
<MSDeployParameterValue Include="$(DeployParameterPrefix)MyDBContext-Web.config Connection String" />

Voila. Second set removed, and I'm good to go.

Andrew
  • 4,145
  • 2
  • 37
  • 42
  • 2
    I had the same problem. I found some duplicate entries in a publish profile from a ["Merge Gone Wild"](http://stackoverflow.com/a/11534645/1804678) – Jess Sep 16 '14 at 17:57
3

instead of deleting, go inside properties/PublishProfiles, open the .pubxml file and check to see if your connection strings have been repeated/duplicated. I had this issue, removed all the duplicate connection strings to leave one remaining and it solved my issue.

PontiusTheBarbarian
  • 1,004
  • 9
  • 17
  • 1
    I removed all the duplication and still got the error. In frustration I tried cleaning the solution, still got the error. And finally, in total desperation, I closed Visual Studio and tried again - this time it worked. I'm putting this comment here to help prevent others from throwing their laptops through the window. – MsTapp Jun 02 '17 at 13:15
1

While @Andrew's method is the correct approach, I find it faster to just delete the offending publish profile and reinstall / create a new one. I keep my publish profile in the same place so it takes about 10 seconds to re-install.

enter image description here

Community
  • 1
  • 1
Dan Beaulieu
  • 19,406
  • 19
  • 101
  • 135
0

I got this error. It turns out there was a binding error with the solution file. Had to delete the publishing files and bind the solution. Then I could use the Publish button again.

Lidia
  • 1
  • It would be helpful to add a little more detail , so that the next person with this issue might have an easier time following your steps. – alteredinstance Feb 21 '20 at 20:36