Page 1 of 1

[VS 2017, EF 6.2] Generating Database from Model with Devart SSDLToPostgreSql.tt template results in an error?

Posted: Wed 03 Apr 2019 15:16
by acsdeveloper
Using dotConnect for PostgreSql 7.12.1357.0 on Visual Studio 2017 (15.8.7) and executing "Generate Database from Model" on a Model First Database in a newly created project with Entity Framework 6.2.0 (.Net Framework 4.5) installed, gives the following error:

Code: Select all

Encountered the following errors while processing the template 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\Devart SSDLToPostgreSql.tt: 

Line 0, Column 0: 'An exception was thrown while trying to compile the transformation code. The following Exception was thrown:

System.IO.FileNotFoundException: Could not find file 'C:\Windows\system32\Devart.Data.PostgreSql.Entity, Version=7.12.1357.6, Culture=neutral, PublicKeyToken=09af7300eec23701'.

File name: 'C:\Windows\system32\Devart.Data.PostgreSql.Entity, Version=7.12.1357.6, Culture=neutral, PublicKeyToken=09af7300eec23701'

...
After hours of guesswork i managed to find the cause.

In the template file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\Devart SSDLToPostgreSql.ttinclude" I replaced

Code: Select all

<#@ assembly name="System.Core" #>
<#@ assembly name="Devart.Data.PostgreSql.Entity, Version=7.12.1357.6, Culture=neutral, PublicKeyToken=09af7300eec23701" #>
with

Code: Select all

<#@ assembly name="System.Core" #>
<#@ assembly name="C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\Entity\EF6\Devart.Data.PostgreSql.Entity.EF6.dll" #>
<#@ assembly name="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\EntityFramework.dll" #>
<#@ assembly name="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Microsoft.Data.Entity.Design.dll" #>
and in the template file "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\Devart SSDLToSQL.ttinclude" I replaced

Code: Select all

<#@ assembly name="System.Core" #>
with

Code: Select all

<#@ assembly name="System.Core" #>
<#@ assembly name="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\EntityFramework.dll" #>
<#@ assembly name="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Microsoft.Data.Entity.Design.dll" #>
Now "it just works", but a fresh install of the driver should not require this kind of a workaround for some features to work.
This problem is also present when using VS 2015, but in that case only the driver name had to be replaced because the template files properly include the EntityFramework dlls as seen below:

Code: Select all

<#@ assembly name="System.Core" #>
<#@ assembly name="Devart.Data.PostgreSql.Entity, Version=7.12.1357.6, Culture=neutral, PublicKeyToken=09af7300eec23701" #>
<#@ assembly name="%VS140COMNTOOLS%..\IDE\EntityFramework.dll" #>
<#@ assembly name="%VS140COMNTOOLS%..\IDE\Microsoft.Data.Entity.Design.dll" #>

Re: [VS 2017, EF 6.2] Generating Database from Model with Devart SSDLToPostgreSql.tt template results in an error?

Posted: Thu 04 Apr 2019 16:27
by Shalex
Thank you for your report. We have fixed the issue.

The only steps required to work around the problem are:

* "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\Devart SSDLToPostgreSql.ttinclude"
replace
Devart.Data.PostgreSql.Entity, Version=7.12.1357.6
with
Devart.Data.PostgreSql.Entity.EF6, Version=7.12.1357.0

* "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\Devart SSDLToPostgreSql.tt"
add
<#@ assembly name="$(DevEnvDir)..\IDE\EntityFramework.dll" #>

Re: [VS 2017, EF 6.2] Generating Database from Model with Devart SSDLToPostgreSql.tt template results in an error?

Posted: Fri 05 Apr 2019 12:46
by acsdeveloper
This would only work if the assemblies are installed in the GAC but I'd prefer not to. Can you make it so it doesn't rely on that?

Re: [VS 2017, EF 6.2] Generating Database from Model with Devart SSDLToPostgreSql.tt template results in an error?

Posted: Fri 12 Apr 2019 18:04
by Shalex
The bug with using the "Generate Database from Model" wizard when working with Entity Framework 6 Tools is fixed: viewtopic.php?f=3&t=38636.