dotnet / dotnet/SqlClient

Issue using Microsoft.Data.SqlClient with PowerShell 7.5.2

Open
#3,577 8 comments 0 reactions 0 assignees View on GitHub
Area\Documentation Up-for-Grabs :raised_hands:
Dominant language
C#
Stars
989
Forks
340
Avg merge
4d 19h
Merged PRs (30d)
72

Description

I have PS scripts that currently use System.Data.SqlClient that I want to convert to Microsoft.Data.SqlClient. I downloaded the NuGet package and first attempted to load the .NET 8.0 and .NET 9.0 assembly. Both return the error:
MethodInvocationException: Exception calling ".ctor" with "1" argument(s): "Microsoft.Data.SqlClient is not supported on this platform."

The netstandard2.0 assembly seems to load fine, but when I try to set the ConnectionString property, it does nothing. No error, but when I check the property, it is blank. I asked ChatGPT for help on this, but all of the suggestions did not work.

I just want to know if it is possible for me to use Microsoft.Data.SqlClient with PowerShell 7.5.2 and if so, what do I need to do. PowerShell 7.5.2 is built on .NET 9.0, so shouldn't the net9.0 version of Microsoft.Data.SqlClient be supported on that?

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.