Downloading ADO.Net Providers from Nuget

A number of ADO.Net providers are supplied for download from Nuget. Typically these Nuget packages are added to a Visual Studio Project and the required DLLs are downloaded as part of building the project. Downloading all the DLLs manually can be tricky so here is a guide:

 

First install the .NET SDK (v5): https://dotnet.microsoft.com/en-us/download/dotnet/5.0

 

This will give you the command line tool 'dotnet' and you can use the following Powershell commands to download the ADO.Net provider and required DLLs for Designer:

 

Example for PostgreSQL

 

Example for Npgsql (PostgreSQL ADO.Net provider), you can either copy these commands into a .ps1 (powershell) script file or run them one at a time on the command line:

 

# Create a new C# project called PostgresProvider

dotnet new console -n PostgresProvider -f net5.0

 

# Store current directory

Push-Location PostgresProvider

 

# Change the project target to .Net Framework 4.6.2

((Get-Content -path PostgresProvider.csproj -Raw) -replace '<TargetFramework>net5.0</TargetFramework>','<TargetFramework>net462</TargetFramework>') | Set-Content -Path PostgresProvider.csproj

 

# Add Npgsql Nuget package to the project

dotnet add package npgsql --version 7.0.7

 

# Build the project

dotnet build --configuration Release

 

# Remove unnecessary files

Remove-Item bin\Release\net462\PostgresProvider.*

 

# Back to where we were

Pop-Location

 

# DLL Files should be in .\PostgresProvider\bin\Release\net462\

 

Copy these files to the C:\Program Files\Apteco\FastStats Designer\Providers\Npgsql directory for Designer to recognise and load the ADO.Net provider

 

Example Postgres connection string:

 

Server=myServer;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword;;sslmode=Require;Trust Server Certificate=true

 

Example for Snowflake

 

Example for Snowflake (Snowflake ADO.Net provider), you can either copy these commands into a .ps1 (powershell) script file or run them one at a time on the command line:

 

# Create a new C# project called SnowflakeProvider

dotnet new console -n SnowflakeProvider -f net5.0

 

# Store current directory

Push-Location SnowflakeProvider

 

# Change the project target to .Net Framework 4.7.2

((Get-Content -path SnowflakeProvider.csproj -Raw) -replace '<TargetFramework>net5.0</TargetFramework>','<TargetFramework>net472</TargetFramework>') | Set-Content -Path SnowflakeProvider.csproj

 

# Add Snowflake.Data Nuget package to the project

dotnet add package Snowflake.Data --version 3.1.0

 

# Build the project

dotnet build --configuration Release

 

# Remove unnecessary files

Remove-Item bin\Release\net472\SnowflakeProvider.*

 

# Back to where we were

Pop-Location

 

# DLL Files should be in .\Provider\bin\Release\net472\

 

Copy these files to the C:\Program Files\Apteco\FastStats Designer\Providers\Snowflake directory for Designer to recognise and load the ADO.Net provider

 

Example Snowflake connection string:

 

account=qo25880;user=abcde;password=ABCDE;host=qo25880.eu-west-1.snowflakecomputing.com;db=SNOWFLAKE_SAMPLE_DATA;schema=TPCH_SF1

 

Example for DuckDB

 

Example for DuckDB.Net, you can either copy these commands into a .ps1 (powershell) script file or run them one at a time on the command line:

 

# Requires the .Net SDK:

# https://dotnet.microsoft.com/en-us/download

mkdir DuckDBProvider

 

# Create a new C# project called DuckDBProvider

dotnet new console -n DuckDBProvider -f net5.0

 

# Store current directory

Push-Location DuckDBProvider

 

# Change the project target to .Net Framework 4.6.2

((Get-Content -path DuckDBProvider.csproj -Raw) -replace '<TargetFramework>net5.0</TargetFramework>','<TargetFramework>net462</TargetFramework>') | Set-Content -Path DuckDBProvider.csproj

 

# Add Npgsql Nuget package to the project

dotnet add package DuckDB.NET.Data.Full

 

# Build the project

dotnet build --configuration Release

 

# Remove unnecessary files

Remove-Item bin\Release\net462\Provider.*

 

# Back to where we were

Pop-Location

# Files should be in .\DuckDBProvider\bin\Release\net462\

 

Copy these files to the C:\Program Files\Apteco\FastStats Designer\Providers\DuckDB directory for Designer to recognise and load the ADO.Net provider

 

Troubleshooting

If you get this message running the scripts "error: There are no versions available for the package..." then you may need to add the default nuget package location by running this command:

dotnet nuget add source https://api.nuget.org/v3/index.json --name nuget.org