Can't open my dbml file in Visual Studio 2010

2019-09-04 17:10发布

问题:

I've been working on a project for a while now. I hadn't touched it in a bit and when I came back to it and tried to open the dbml file, I'm getting this error.

The 'Microsoft.VisualStudio.Data.Providers.SqlCompact.VsPackage, Microsoft.VisualStudio.Data.Providers.SqlCompact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' package did not load correctly.

The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by running the application together with the /log parameter on the command line, and then examining the file 'C:\Users\Gary\AppData\Roaming\Microsoft\VisualStudio\10.0\ActivityLog.xml'.

After you click OK on that error, another pop-up appears and says, "Visual studio has encountered an unexpected error."

I tried repairing Visual Studio 2010 and that didn't help, so I also uninstalled and reinstalled it. Still no luck. Anyone have any idea what's going on and how to fix it?

Update: I started Visual Studio 2010 from the command prompt with the /log parameter and examined the log file that was generated. Seeing these errors.

<entry>
    <record>377</record>
    <time>2011/08/03 20:30:38.399</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [Microsoft.VisualStudio.Data.Providers.SqlCompact.VsPackage, Microsoft.VisualStudio.Data.Providers.SqlCompact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91]</description>
    <guid>{51DD7941-149C-412F-8583-04644B87305F}</guid>
    <hr>80131522</hr>
    <errorinfo>Could not load type 'Microsoft.VSDesigner.VSDesignerPackage.ICustomProviderAssemblyService' from assembly 'Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.</errorinfo>
  </entry>
  <entry>
    <record>378</record>
    <time>2011/08/03 20:30:38.403</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>End package load [Microsoft.VisualStudio.Data.Providers.SqlCompact.VsPackage, Microsoft.VisualStudio.Data.Providers.SqlCompact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91]</description>
    <guid>{51DD7941-149C-412F-8583-04644B87305F}</guid>
    <hr>80131522</hr>
    <errorinfo>Could not load type 'Microsoft.VSDesigner.VSDesignerPackage.ICustomProviderAssemblyService' from assembly 'Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.</errorinfo>
  </entry>

And Googling on those <errorinfo> lines yields no results.

回答1:

I decided to recreate the dbml file from scratch. I was about 90% done with it when I decided to try clicking on the old dbml, just for the heck of it. And guess what happened? It opened and worked just fine.

Seems like something with the designer was screwed up and fixed itself after I created a fresh dbml. Would recommend anyone with this issue at least give it a shot.



回答2:

I have found that when all else fails it's time to restart Visual Studio. I did that and my dbml was able to load fine.