Skip to content
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

File Version for Package Microsoft.Data.SqlClient 5.1 lists as 5.0 #1945

Closed
DataJuggler opened this issue Mar 6, 2023 · 22 comments · Fixed by #2093
Closed

File Version for Package Microsoft.Data.SqlClient 5.1 lists as 5.0 #1945

DataJuggler opened this issue Mar 6, 2023 · 22 comments · Fixed by #2093
Labels
netcore Potential Regression Has not been confirmed as a regression, but it was working properly on a previous version

Comments

@DataJuggler
Copy link

DataJuggler commented Mar 6, 2023

Describe the bug

My actual bug is a release version of my opensource project DBCompare says 'Can't find Microsoft.Data.SqlClient 5.0'.
This is strange to me, because the package that brings in Microsoft.Data.SqlClient references version 5.1.
I looked in the bin directory of my project, and Windows Explorer lists the class as File Version 5.0.0.

I recreated a new project, and added only Microsoft.Data.SqlClient 5.1, and in Windows Explorer, it lists as File Version 5.0.

This makes it harder for me to determine why the release version is not working. Is something actually looking for 5.0 version, or is the message shown for can't find 5.1 but the file version is 5.0 so it shows me the wrong message?

Here are the references from my project
image

When I add the file in Advanced Installer, Advanced Installer lists the file as version 5.0:

image

The code is here if it helps:
https://github.com/DataJuggler/DBCompare

The Release version has the problem. Install the app. Click on the Connection elipses ..., and in the Connection String Builder Form when you click the Build Connection String button is when the error happens.

It is hard to debug this 5.1 Microsoft.Data.SqlClient lists as 5.0. Not sure why the app can't find the file, the file Microsoft.Data.SqlClient is included in the install directory.

If you are seeing an exception, include the full exceptions details (message and stack trace).

Exception message:
Stack trace:

Here is the error result from the install version:
See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5'. The system cannot find the file specified.
File name: 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5'
   at DataJuggler.Net7.ConnectionStringHelper.BuildConnectionString(String serverName, String databaseName, Boolean encrypt)
   at DBCompare.ConnectionStringBuilderForm.BuildConnectionStringButton_Click(Object sender, EventArgs e) in C:\Projects\GitHub\DBCompare\DBCompare\ConnectionStringBuilderForm.cs:line 67
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
System.Private.CoreLib
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Private.CoreLib.dll
----------------------------------------
DBCompare
    Assembly Version: 7.0.0.0
    Win32 Version: 6.3.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Data%20Juggler/DB%20Compare%207.0.0/DBCompare.dll
----------------------------------------
System.Runtime
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Runtime.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60608
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/7.0.2/System.Windows.Forms.dll
----------------------------------------
System.ComponentModel.Primitives
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.ComponentModel.Primitives.dll
----------------------------------------
System.Windows.Forms.Primitives
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60608
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/7.0.2/System.Windows.Forms.Primitives.dll
----------------------------------------
System.Runtime.InteropServices
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Runtime.InteropServices.dll
----------------------------------------
System.Drawing.Primitives
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Drawing.Primitives.dll
----------------------------------------
System.Collections.Specialized
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Collections.Specialized.dll
----------------------------------------
DataJuggler.Win.Controls
    Assembly Version: 7.1.1.0
    Win32 Version: 6.1.2
    CodeBase: file:///C:/Program%20Files%20(x86)/Data%20Juggler/DB%20Compare%207.0.0/DataJuggler.Win.Controls.dll
----------------------------------------
System.Threading
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Threading.dll
----------------------------------------
System.Diagnostics.TraceSource
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Diagnostics.TraceSource.dll
----------------------------------------
System.Collections
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Collections.dll
----------------------------------------
System.Drawing.Common
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/7.0.2/System.Drawing.Common.dll
----------------------------------------
Microsoft.Win32.Primitives
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/Microsoft.Win32.Primitives.dll
----------------------------------------
System.ComponentModel.EventBasedAsync
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.ComponentModel.EventBasedAsync.dll
----------------------------------------
System.Threading.Thread
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Threading.Thread.dll
----------------------------------------
Accessibility
    Assembly Version: 4.0.0.0
    Win32 Version: 7.0.222.60608
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/7.0.2/Accessibility.dll
----------------------------------------
System.ComponentModel.TypeConverter
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.ComponentModel.TypeConverter.dll
----------------------------------------
System.ComponentModel
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.ComponentModel.dll
----------------------------------------
System.Memory
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Memory.dll
----------------------------------------
System.Numerics.Vectors
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Numerics.Vectors.dll
----------------------------------------
Microsoft.Win32.SystemEvents
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/7.0.2/Microsoft.Win32.SystemEvents.dll
----------------------------------------
System.Resources.Extensions
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/7.0.2/System.Resources.Extensions.dll
----------------------------------------
System.Drawing
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60608
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/7.0.2/System.Drawing.dll
----------------------------------------
System.Collections.Concurrent
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Collections.Concurrent.dll
----------------------------------------
System.ObjectModel
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.ObjectModel.dll
----------------------------------------
System.Linq
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Linq.dll
----------------------------------------
System.Collections.NonGeneric
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Collections.NonGeneric.dll
----------------------------------------
System.Configuration.ConfigurationManager
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.WindowsDesktop.App/7.0.2/System.Configuration.ConfigurationManager.dll
----------------------------------------
DataJuggler.UltimateHelper
    Assembly Version: 1.6.8.0
    Win32 Version: 1.6.8.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Data%20Juggler/DB%20Compare%207.0.0/DataJuggler.UltimateHelper.dll
----------------------------------------
System.Private.Uri
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Private.Uri.dll
----------------------------------------
System.Security.Cryptography
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Security.Cryptography.dll
----------------------------------------
System.Xml.ReaderWriter
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Xml.ReaderWriter.dll
----------------------------------------
System.Private.Xml
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Private.Xml.dll
----------------------------------------
System.Net.WebClient
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Net.WebClient.dll
----------------------------------------
System.Text.Encoding.Extensions
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Text.Encoding.Extensions.dll
----------------------------------------
System.Runtime.Serialization.Formatters
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Runtime.Serialization.Formatters.dll
----------------------------------------
System.Xml.XmlSerializer
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Xml.XmlSerializer.dll
----------------------------------------
DataJuggler.Net7
    Assembly Version: 7.0.2.0
    Win32 Version: 7.0.2.0
    CodeBase: file:///C:/Program%20Files%20(x86)/Data%20Juggler/DB%20Compare%207.0.0/DataJuggler.Net7.dll
----------------------------------------
System.Runtime.Loader
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Runtime.Loader.dll
----------------------------------------
System.Diagnostics.StackTrace
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Diagnostics.StackTrace.dll
----------------------------------------
System.Reflection.Metadata
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Reflection.Metadata.dll
----------------------------------------
System.Collections.Immutable
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Collections.Immutable.dll
----------------------------------------
System.IO.MemoryMappedFiles
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.IO.MemoryMappedFiles.dll
----------------------------------------
System.Diagnostics.FileVersionInfo
    Assembly Version: 7.0.0.0
    Win32 Version: 7.0.222.60605
    CodeBase: file:///C:/Program%20Files/dotnet/shared/Microsoft.NETCore.App/7.0.2/System.Diagnostics.FileVersionInfo.dll
----------------------------------------

************** JIT Debugging **************

To reproduce

Include a complete code listing (or project/solution) that we can run to reproduce the issue.

Partial code listings, or multiple fragments of code, will slow down our response or cause us to push the issue back to you to provide code to reproduce the issue.

Console.WriteLine("Hello World!");

Expected behavior

A clear and concise description of what you expected to happen.

Further technical details

Microsoft.Data.SqlClient version: (found on the nuget or Microsoft.Data.SqlClient.dll)
.NET target: (e.g. Framework 4.7.1, Core 2.2.2)
SQL Server version: (e.g. SQL Server 2017)
Operating system: (e.g. Windows 2019, Ubuntu 18.04, macOS 10.13, Docker container)

Additional context
Add any other context about the problem here.

@lcheunglci
Copy link
Contributor

lcheunglci commented Mar 7, 2023

Hi @DataJuggler, thanks for bringing this issue to our attention. I tried your project from your repo, and was able to see the same observation and when inspected nuget package for Microsoft.Data.SqlClient 5.1.0 using nuget package explorer, and noticed that runtimes\win\lib\net6.0\Microsoft.Data.SqlClient.dll shows the AssemblyFileVersion as 5.0.0 and runtimes\win\lib\net462\Microsoft.Data.SqlClient shows the AssemblyFileVersion as 5.10.23019.2. I'll double check with the team to verify if this is a bug or as designed and get back to you soon.

@DataJuggler
Copy link
Author

Thank you very much. Problems that work in Visual Studio and not in deployment are always the hardest to solve.

@leafkevin
Copy link

Microsoft.Data.SqlClient 5.1.1 version, we release to azure container ,and got the same error.

Detail:System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5'. The system cannot find the file specified.\n\nFile name: 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5'\n at Thea.Trolley.SqlServerProvider.CreateConnection(String connectionString)\n at Thea.Trolley.OrmDbFactory.Create(String dbKey, Nullable1 tenantId)\n at PA.Account.Api.Controllers.SignInController.CreateToken(String account) in /home/vsts/work/1/s/src/PA.Account.Api/Controllers/SignInController.cs:line 410\n at lambda_method6(Closure , Object )\n at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\n--- End of stack trace from previous location ---\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\n at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)\n at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)\n at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\n at Thea.Web.TheaWebMiddleware.Invoke(HttpContext context)

@leafkevin
Copy link

leafkevin commented Apr 27, 2023

Direct use 'dotnet PA.Account.Api.dll' runs do not report errors,using the docker container 'docker run -d -p 8000:80 --name account -e ASPNETCORE_ENVIRONMENT=Sandbox account:latest' will result in an error。
Change to 'System.Data.SqlClient' ,the same error, just the error message is different。

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5'. The system cannot find the file specified.\n\nFile name: 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5'\n at Thea.Trolley.SqlServerProvider.CreateConnection(String connectionString)\n at Thea.Trolley.OrmDbFactory.Create(String dbKey, Nullable1 tenantId)\n at PA.Account.Api.Controllers.SignInController.CreateToken(String account) in /home/vsts/work/1/s/src/PA.Account.Api/Controllers/SignInController.cs:line 410\n at lambda_method6(Closure , Object )\n at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\n--- End of stack trace from previous location ---\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\n at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\n at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)\n at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)\n at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\n at Thea.Web.TheaWebMiddleware.Invoke(HttpContext context)

@DataJuggler
Copy link
Author

I still don't have a solution for this.

@DataJuggler
Copy link
Author

I resolved this in one of my projects, by opening (ProjectNames).deps.json (or something close to that). One of the .NET 6.0 reference entries listed assemblyversion of Microsoft.Data.SqlClient at 5.0.0. I think when I updated this project to .NET 7, this entry is not erased and thus caused the problem. At least I know how to fix it now. Checking the installer versions soon to see if they are fixed.

@byronbennett
Copy link

If there are any work arounds, I'd be obliged:

I am facing this issue as well, .Net7 WPF app. Everything runs fine in VS, both Debug and Release, but when I create an MSI and deploy, I'm getting the error below. I have tried using Nugets for Microsoft.Data.SqlClient 5.1.1, 5.0.0 and also preview of 5.2.0
(PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0-preview3.23201.1" />). All examples give me the following:

CoreCLR Version: 7.0.1023.36312
.NET Version: 7.0.10
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5'. The system cannot find the file specified.

The File in the Application folder once deployed looks like:
image

@JRahnama
Copy link
Member

JRahnama commented Sep 5, 2023

@byronbennett this has been addressed and will be available in next preview release.

@DavoudEshtehari DavoudEshtehari linked a pull request Oct 3, 2023 that will close this issue
@DataJuggler
Copy link
Author

DataJuggler commented Oct 20, 2023

I was finally able to solve this today. What worked was changing the deps.json file to 5.1.1, even though the .dll itself lists as 5.0.0 for File Version:

"runtime": {
"lib/net6.0/Microsoft.Data.SqlClient.dll": {
"assemblyVersion": "5.1.1.0",
"fileVersion": "5.1.1.0"

I still hope this is corrected in Microsoft.Data.SqlClient, but at least I am able to make a release version for my project now.

@jmb-mage
Copy link

Thank you for fixing this in 5.1.2
We are using Microsoft.Data.SqlClient.dll as dependency of Microsoft.EntityFrameworkCore.SqlServer
While we wait for the packages to update, is there a previous version of Microsoft.EntityFrameworkCore.SqlServer that does not have this issue?

@ErikEJ
Copy link
Contributor

ErikEJ commented Oct 27, 2023

@jmb-mage yes, EF Core 6. But what are you waiting for? You can just add an explicit reference to 5.1.2.

@ankushlalit
Copy link

We updated the version to 5.1.2 but still getting the below error
FileNotFoundException: Could not load file or assembly 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5'. The system cannot find the file specified.

@lukemason76
Copy link

lukemason76 commented Dec 6, 2023

Was this reverted in 5.1.2?
Have just updated project to .NET 8, updated all libraries, but when deploying a release build, it throws

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5'. The system cannot find the file specified.

I'm not really brave enough to hand edit my deps...

@diegoaraujolima
Copy link

I'm using .net 8 and the 5.2.1 package and the problem persists:

Microsoft.Data.SqlClient is not supported on this platform.

This is happening with a Class Library project in the release.

@AliDeV7
Copy link

AliDeV7 commented Jul 3, 2024

Same issue in .Net 7 and Microsoft.Data.SqlClient 5.2.1

I edit deps.json to 5.2.1.0 but still not working and get Microsoft.Data.SqlClient is not supported on this platform.

@arellegue
Copy link
Contributor

@diegoaraujolima Could you provide a repro, please?

@arellegue
Copy link
Contributor

@DataJuggler Could you please provide the steps to reproduce the issue. I have cloned the repro from your repository. However, I have not been able to reproduce the issue.

@DataJuggler
Copy link
Author

@DataJuggler Could you please provide the steps to reproduce the issue. I have cloned the repro from your repository. However, I have not been able to reproduce the issue.

I fixed the problem as described above by fixing the deps.json file in the project. One of the old commits has the problem, but sorry I didn't record which commit version.

@arellegue
Copy link
Contributor

arellegue commented Aug 21, 2024

@DataJuggler I have downloaded the DBCompare 7.02 version source code. However, I can not find the supposedly deps.json file.

Could you provide the repro please with the issue that can be reproduced. As well, please provide the exact steps you took to get the error message.

This will help us to understand the root cause because at this time, even with version 5.1.0, which shows the difference in File Versions and Product versions, it still works in my test project that I published and ran the executable in the published folder.

@DavoudEshtehari DavoudEshtehari added the Potential Regression Has not been confirmed as a regression, but it was working properly on a previous version label Sep 6, 2024
@LeDahu22
Copy link

I encountered this problem using a .NET 8 library project, only with the published version. I enabled ReadyToRun option in my publish configuration and the problem went away. If that can help someone...

@arellegue
Copy link
Contributor

@LeDahu22 , Could you provide a repro project, please? I tried to reproduce the issue but could not. If you can provide a project that reproduces the issue, it will help us identify the root cause.

@arellegue
Copy link
Contributor

The issue is not reproducible, so it is being closed.

Feel free to re-open and provide a repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
netcore Potential Regression Has not been confirmed as a regression, but it was working properly on a previous version
Projects
Development

Successfully merging a pull request may close this issue.