Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i do DbProviderFactories in .Net Standard 2.0 project as my main Application is framework 4.7.2

I have my main project in Framework 4.7.2 , and this project references a netStandard Library project which is a netstandard 2.0.

I need "DbProviderFactories" in the .Net Standard project.

like:

System.Data.Common.DbProviderFactory fact = System.Data.Common.DbProviderFactories.GetFactory(providername);

I can Change the netStandard Project version to 2.1, which contains DbProviderFactories, but netstandard 2.1 does not consume with framework 4.7.2

Is there any Other way I can do this.

like image 357
BeeGees Avatar asked Jan 20 '26 02:01

BeeGees


1 Answers

You just need to add this tag to your app.config, it will enable to work with legacy version of the .net framework.

<startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
like image 74
Gustavo Oliveira Avatar answered Jan 21 '26 16:01

Gustavo Oliveira



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!