1

I'm making a model-first database and I'm trying to generate my MySql schema. When I click on "Generate Database from Model" it gives me this error

Encountered the following errors while processing the template 'E:\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToMySQL.tt: 

Line 141, Column 0: 'Running transformation: System.NullReferenceException: Object     reference not set to an instance of an object.

   at Microsoft.VisualStudio.TextTemplatingE384461094E1DFC8313DC1AA4CE547BEB91411CCECC4E940B2CAA4A167C5F68F403F4103FA7B7E1BB1B4B97B86595FBABCAF62EA3385ABAA9AF47E060E49D857.GeneratedTextTransformation.GetProviderManifestToken(String edmxPath) in e:\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\GenerateMySQL.Utility.ttinclude:line 142

   at Microsoft.VisualStudio.TextTemplatingE384461094E1DFC8313DC1AA4CE547BEB91411CCECC4E940B2CAA4A167C5F68F403F4103FA7B7E1BB1B4B97B86595FBABCAF62EA3385ABAA9AF47E060E49D857.GeneratedTextTransformation.TransformText() in e:\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToMySQL.tt:line 121'

I went and checked the references files and I'm not sure what I should do. Here are the files content at the targetted lines.

GenerateMySQL.Utility.ttinclude

(142 -->) foreach (var node in xmlDocument.SelectSingleNode("/edmx:Edmx/edmx:Runtime/edmx:StorageModels", namespaceMgr).ChildNodes)
{
  if (((XmlNode)node).Name.Equals("Schema") && ((XmlNode)node).Attributes.GetNamedItem("ProviderManifestToken") != null)
  {
      return ((XmlNode)node).Attributes["ProviderManifestToken"].Value;
  }
}
return String.Empty;

SSDLToMySQL.tt

EnvDTE.DTE env = (EnvDTE.DTE)((IServiceProvider)this.Host).GetService(typeof(EnvDTE.DTE));      
(121 -->)string serverVersion = GetProviderManifestToken(edmxPath);
string connection = String.Empty;

I know it used to work before but now it just gives me this error. It is an extremely simple schema, 3 tables with Strings and Int32's, some relationships. The project is otherwise empty and no modifications have been done other than the initial setup of the Mysql connection.

I have MySql Connector version 6.7.4 and Entity Framewiork v6.0.1 on Visual Studio 2012.

2 Answers 2

3

I solved the problem by changing the SSDLToMySQL.tt at line 121 from

string serverVersion = GetProviderManifestToken(edmxPath);

to

string serverVersion = String.Empty;

Looks like it now finds the correct .edmx file.

Sign up to request clarification or add additional context in comments.

1 Comment

I was having this exact same problem, your solution worked, you rock!
0

I tried Tristan Dube's answer but ran into later issues. I now appear to have a working configuration with EF6, mysql-connector-net-6.8.3, and mysql-visualstudio-plugin-1.1.1. The mysql-installer-community-5.6.15.0 didn't offer either of these, so I found them on a mirror of mysql.com: ftp://gd.tuwien.ac.at/db/mysql/Downloads/Connector-Net/mysql-connector-net-6.8.3.msi ftp://gd.tuwien.ac.at/db/mysql/Downloads/MySQLInstaller/mysql-visualstudio-plugin-1.1.1.msi

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.