Could not load file or assembly 'Microsoft.Data.SqlClient

后端 未结 3 541
我寻月下人不归
我寻月下人不归 2020-12-07 02:52

I am calling a .net standard 2.0 library from a framework 4.7.2 test project sucessfully.

If I take my .net standard 2.0 dll (SBD.Standard) and create a new winform

相关标签:
3条回答
  • 2020-12-07 03:22

    just hit the same error with ASP.NET 4.7.2 (updated from net 4.6) project which reference netstandard 2.0 project (ef core 3.x). (on azure app service)

    after trying to clean/rebuild/nuget reinstall .. i removed everything from app service and published project again. error dismissed.

    0 讨论(0)
  • 2020-12-07 03:25

    Although it would be ideal if the extra packages were added automatically.

    Assuming we have one .net standard project which depends on Microsoft.EntityFrameworkCore, Microsoft.EntityFrameworkCore.SqlServer and other packages. The expected behavior for us is to create a nuget package in whose xx.nuspec file has definitions about the dependencies.

    But there's one issue about nuget pack command, it can't work well for .net core/standard project. Both nuget pack and dotnet pack can create .net standard nuget packages successfully, but pack successfully doesn't mean good package.

    With the effect of the issue above, package created by nuget pack will lose some dependencies in Package.nuspec file. (Rename xx.nupkg to xx.zip, then we can check the content inside package, we'll see the xx.nuspec file)

    And above step can cause runtime error like missing assembly. So to make it ideal that the extra packages are added automatically and avoid missing reference, we recommend dotnet pack command for projects using PackageReference format. (No matter dotnet pack command locally or dotnet pack task in Azure Devops Piepilne)

    0 讨论(0)
  • 2020-12-07 03:42

    I re-experienced this recently and could not solve with the above method. I decided to separate the .netstandard2.0 projects from the net472 projects into different Azure projects.

    Investigating ...

    0 讨论(0)
提交回复
热议问题