-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.NET Standard library not working with .NET Framework #2786
Comments
Hi @LNA-DEV we'll look into this issue further. Can I confirm again - Microsoft.Data.SqlClient 5.1.3 is the earliest working version? So 5.1.4 and beyond all encounter the same issue? |
Hej @dauinsight I experimented a bit with the different versions. Using the MRE it throws the same exception regardless of the version. But if I add In our real code it behaves a bit different. I think this is because we run the If I try to do the same process with a newer version I get the exception:
with stack trace:
|
I double checked the versions and found out that I was wrong. Version 5.1.5 is the latest working one. Version 5.2.0 and 5.2.1 both have the same error. |
Thanks for the details If the latest failing version is 5.2.0: it sounds like this could be related to issue #2535. We are releasing 5.2.2 hotfix soon that will address this issue so stay tuned for that. |
@LNA-DEV I would suggest going through this documentation first, have you tried having a multi target frameworks for your application instead of having two separate projects? I had a brief look at your repro and those two netcore and netframework are looking almost identical. Based on the documentation provided it is better to do so |
@JRahnama It is a bit more complex in our real world implementation. I added the two projects mainly to show the difference between .NET and .NET Framework. We are building a sort of plugin for our software which currently runs in Framework. But for the future we want to have the flexibility to change that and therefore want to use .NET Standard for the plugin. (Which only works in version 5.1.5 that's the issue) Multi targeting might be something worth looking into in the future but I am not sure how well it works in our case, because we are doing a bit of manual DLL loading. However thanks for the suggestion. Could be a benefit for us👍 Nevertheless if I install a NuGet which has support for .NET Standard I expect it to work in both Framework and .NET. Which I think currently is not the case. |
@LNA-DEV I tested below scenarios:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\StandardLibary\StandardLibary.csproj" />
</ItemGroup>
</Project> |
@JRahnama I can confirm this workaround is working for the project I provided. (But I do not understand why. What is SDK-style changing?) For our production application this does not work because we are publishing the .NET Standard project directly (with runtime win). But we are using v5.1.5 there until the NuGet is fixed. |
FYI: Version 5.2.2 does not seem to solve this issue
|
Describe the bug
If you are using the
Microsoft.Data.SqlClient
NuGet in a .NET Standard project which you are referencing in a .NET Framework project it throws the following exception.I also noticed that if you take a closer look at the DLLs provided by the NuGet you can see that in the netstandard2.0 folder there only is a .NETCoreApp v8.0 DLL and not the required .NET Standard one.
Workaround
For me the only way to get the NuGet to work is using a older version (5.1.3). But since then there is the wrong version in the .NET Standard folder.
To reproduce
To reproduce this issue you can take a look at this MRE: https://github.com/LNA-DEV/SqlClient.FrameworkStandard.MRE
As you can see .NET works without any issues while .NET Framework throws an exception.
Expected behavior
If there is a .NET Standard version of a NuGet I suspect that it would work on .NET and .NET Framework.
Further technical details
Microsoft.Data.SqlClient version: 5.2.1
.NET target: v4.8
Operating system: Windows
The text was updated successfully, but these errors were encountered: