I needed to add TextTemplatingFileGenerator to the .tt file Properties → Advanced → Custom Tool in Visual studio.
(Riders pick them up automatically but they replied that they have limited support for the envdte library).
Now Vs2019 detect them and I can run and debug them etc.
I already used AutoQuery AutoGen and it worked perfectly.
I’m stuck with a legacy DB that has hundreds of stored procedures… So I was hoping not to have to code them all by hand.
The comment in OrmLite.Core.ttinclude says:
In order to work, the appropriate driver must be registered in the system machine.config file. If you’re
using Visual Studio 2010 the file you want is here:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
I’ve added the suggested entries in machine.config (32 and 64 bits folders) except with the newest versions:
<system.data>
<DbProviderFactories>
<add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=4.6.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<add name="Odbc Data Provider" invariant="System.Data.Odbc" description=".Net Framework Data Provider for Odbc" type="System.Data.Odbc.OdbcFactory, System.Data, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/>
<add name="OleDb Data Provider" invariant="System.Data.OleDb" description=".Net Framework Data Provider for OleDb" type="System.Data.OleDb.OleDbFactory, System.Data, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/>
</DbProviderFactories>
</system.data>
From Visual Studio command line I’ve added the dll in my bid/debug to the gac by running:
gacutil -i .\System.Data.SqlClient.dll
gacutil -i .\System.Data.Odbc.dll
gacutil -i .\System.Data.OleDb.dll
I’m still getting this error in the generated .cs file for the storedprocedure:
// This file was automatically generated by the PetaPoco T4 Template
// Do not make changes directly to this file - edit the template instead
//
// The following connection settings were used to generate this file
//
// Connection String Name: DefaultConnection
// Provider: Microsoft.Data.SqlClient
// Connection String: Server=localhost\SQLEXPRESS;Database=LEGACYDB;Trusted_Connection=True;
// Schema: ``
// Include Views: False
// -----------------------------------------------------------------------------------------
// Failed to load provider Microsoft.Data.SqlClient
- Unable to find the requested .Net Framework Data Provider. It may not be installed.
// -----------------------------------------------------------------------------------------
If you have any ideas as to what might be causing this please let me know.
I’ve reboot visual studio etc.
Thanks