[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
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:
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
with
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
with
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
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'
...
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" #>
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" #>
Code: Select all
<#@ assembly name="System.Core" #>
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" #>
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" #>