Bug #67964 Generate database from simple model fails in Visual Studio 2012
Submitted: 22 Dec 2012 7:16 Modified: 28 Nov 2013 21:10
Reporter: Daniel McGloin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Visual Studio Integration Severity:S2 (Serious)
Version:6.6.4 OS:Windows (8)
Assigned to: Gabriela Martinez Sanchez CPU Architecture:Any
Tags: tools-1.0.3, tools-1.1.1

[22 Dec 2012 7:16] Daniel McGloin
Description:
In Visual Studio 2012, I get the following error when working through a basic example from this page:

http://msdn.microsoft.com/en-us/data/jj205424

Error message in dialog: "Encountered the following errors while processing the template 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToMySQL.tt: "

How to repeat:
Install Windows 8 (not sure if necessary)
Install Visual Studio 2012 w/ SP1 (not sure if SP1 is necessary)
Install MySQL w/ .NET Connector

Create a new web site project
Add an Entity model (.edmx)
Add a single entity

Change the model's "DDL Generation Template" property to: "SSDLToMySQL.tt (VS)"

Right-click the model and choose "Generate Database from Model.."

Establish a connection to an empty freshly created MySQL database

Click Next to view auto-generated DDL

Click Finish

Error dialog appears with message:

"Encountered the following errors while processing the template 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToMySQL.tt: "
[23 Jan 2013 18:56] Fernando Gonzalez.Sanchez
Hi,

Yes, this seems to happen the first time, we are checking on a fix.

Oddly enough, the workaround is to try again, the problem just seems to happen the first time.
[24 Feb 2013 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[29 May 2013 20:52] Fernando Gonzalez.Sanchez
This is verified, it fails in VS2012 for EF 5 (although works for EF 4.3).

The error provided is by Visual Studio is something like:

Encountered the following errors while processing the template 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToMySQL.tt:
Line 132, Column 0:' Running transformation:
System.ArgumentException: Version string portion was to short or too long.
at System.Version.VersionResult.SetFailure( ParserFailureKind failure, String argument )
at System.Version.TryParserVersion( String version, VersionResult& result )
at System.Version.Parser( String input )
at System.Version..ctor(String version )
at MySql.Data.MySqlClient.MySqlScriptServices.GetTableCreateScript( EntitySet entitySet, String connectionSTring, String version )
at
Microsoft.VisualStudio.TextTemplatingEC7AD8F9FBE0E4583F2618228C4182E3CCEE1C700F320D1F98B9908646EAFA8024A750223ACC9C5A71B36A0AEE5FD12A02298E7F752E89E2BAE365DAC8A8BB03.GeneratedTextTransformation.TransformText() in c:\Program Files(x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToMySQL.tt:line 133'
[29 May 2013 20:52] Fernando Gonzalez.Sanchez
Workaround:

The problem seems to be the model.edmx file has a a wrong manifest token,pointing to MSSQL, like:

      <Schema xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl" Namespace="Model2.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005">

Changing it to MySql like

      <Schema xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl" Namespace="Model2.Store" Alias="Self" Provider="MySql.Data.MySqlClient" ProviderManifestToken="5.6">

Makes the model generation work fine.

Making priority P3 due to workaround.
[23 Aug 2013 22:55] Lukas Faber
Having the same issue with current VS2012, EF5 and Connector 6.7.4.0 ... 

After applying the workaround I am still getting an error ... will upload screenshot ...
[23 Aug 2013 22:56] Lukas Faber
Error appearing on current VS2012, EF5 and Connector 6.7.4.0

Attachment: Screen Shot 2013-08-23 at 3.51.29 PM.png (image/png, text), 26.72 KiB.

[20 Sep 2013 23:48] Ulrich Strauss
To workaround the problem you have to do 3 Things:

a) Add an entry for the connection to use in app.conig/web.config in "connectionStrings". E.g. Simply import any empyt DB from the ame server with saving the connection. Make sure it's teh FIRST entry in connectionStrings.

b) In "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToMySQL.tt" alter Line 121  
From
string serverVersion = GetProviderManifestToken(edmxPath);
To
string serverVersion = String.Empty;

c) make sure the Schema-Tag in the edmx Files reads
Provider="MySql.Data.MySqlClient" ProviderManifestToken="5.5"

This works fine. Just need to execute the sql script manually.
[20 Nov 2013 21:47] Armando Lopez Valencia
Posted by developer:
 
[ARMANDO]
PASS
Verified in:
Windows 8x64
VS 2013
Windows 7x64
VS 2010
MySQL Server 5.6
connector .NET 6.8.1
M4VS 1.1.1 Build20
****Important****
You have to select the correct "DDL Generation template" (In the entity property) for this option to work properly.
A known issue has been found in VS2010 that forces you to go back and forward in order to create the script.
[28 Nov 2013 21:10] Daniel So
Added the following entry to the MySQL for Visual Studio 1.1.1 changelog:

"Generation of database from a simple model failed in Visual Studio 2012.
Important: For this fix to work, you have to select the correct DDL Generation Template as an entity property. Also, there is a known issue found with Visual Studio 2010, which forces the user to go back and forth between steps in order to create the SQL script. "