我在这里尝试尝试一些东西,但是一直失败。

我在Windows Server 2008 R2上安装了Visual Studio Developer Preview。如您所知,目前VS扩展与VS 11 Dev Preview不兼容,但是我找到了一种解决方法:

Visual Studio扩展和Visual Studio 11开发。预览

我在 ADO.NET C#DbContext Generator VS 11,但是当我尝试运行代码生成时,出现以下错误:

错误:此模板试图加载组件装配体 'Microsoft.Data.Entity.Design,版本= 10.0.0.0,文化=中性, PublicKeyToken= b03f5f7f11d50a3a'。有关此问题的更多信息 以及如何启用此模板,请参阅以下文档 自定义项目模板。

我从添加参考页面检查过,没有上面的dll。

只要有机会我就可以使用VS 11 Dev进行这项工作。预览?

有帮助吗?

解决方案

Ok, I solved the problem but I am not sure it is legitimate or not.

when you unzip the extension, navigate to T/code/ folder inside that, there is a zip file called DbContextCS.zip. Unzip that as well, and you will see file called ADONETArtifactGenerator_DbContextCSharp.vstemplate

Open this up with text editor and change this code:

  <WizardExtension>
    <Assembly>Microsoft.Data.Entity.Design, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
    <FullClassName>Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.AddArtifactGeneratorWizard</FullClassName>
  </WizardExtension>

To this one:

  <WizardExtension>
    <Assembly>Microsoft.Data.Entity.Design, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
    <FullClassName>Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.AddArtifactGeneratorWizard</FullClassName>
  </WizardExtension>

Pack everything back together and install the extension, when you run the code gen., you will have no problem.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top