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

.NET 5 single file fails to execute #812

Closed
jjxtra opened this issue Nov 21, 2020 · 6 comments
Closed

.NET 5 single file fails to execute #812

jjxtra opened this issue Nov 21, 2020 · 6 comments

Comments

@jjxtra
Copy link

jjxtra commented Nov 21, 2020

Describe the bug

A clear and concise description of what the bug is.

This error is output upon referencing Microsoft.Data.SqlClient v. 2.1.0 and trying to open a sql connection in a .net 5 single file app with embedded binaries. Issue also exists when not embedding the binaries.

Error:

  An assembly specified in the application dependencies manifest (DigitalRuby.IPBanProWebAdmin.deps.json) was not found:

    package: 'Microsoft.Data.SqlClient.SNI.runtime', version: '2.0.1'

    path: 'runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.pdb'

To reproduce

using SqlConnection conn = new SqlConnection("...");
conn.Open();

Expected behavior

Shouldn't need a pdb to run regardless of single file or not

Further technical details

Microsoft.Data.SqlClient version: (found on the nuget or Microsoft.Data.SqlClient.dll)
.NET 5 nuget of Microsoft.Data.SqlClient 2.1.0
Windows Server 2019 x64

The latest nuget packages for Microsoft.Data.SqlClient are fouled up. They onlly have .net framework resources in them.

I copied the pdb manually to the root of my single file publish folder and then things started working.

@cheenamalhotra
Copy link
Member

cheenamalhotra commented Nov 21, 2020

Please confirm you're referencing v2.1.0 of Microsoft.Data.SqlClient and not confusing with v2.0.1.
I'm able to connect without any issue.

image

@cheenamalhotra
Copy link
Member

cheenamalhotra commented Nov 21, 2020

Your dependency hierarchy should be as under:

Microsoft.Data.SqlClient v2.1.0
-- Microsoft.Data.SqlClient.SNI.runtime v2.1.1 (auto-referenced - does not contain any PDB)

image

@ErikEJ
Copy link
Contributor

ErikEJ commented Nov 21, 2020

@jjxtra Please share your csproj

@jjxtra
Copy link
Author

jjxtra commented Nov 21, 2020

I'm using entity framework core 5.0, I suspect that is the culprit, I will try to get a minimal csproj for you

@cheenamalhotra
Copy link
Member

Hi @jjxtra

I've opened this request to EF Core team: dotnet/efcore#23453
Closing issue from our side, as you confirmed fix here: #652 (comment)

@jjxtra
Copy link
Author

jjxtra commented Nov 23, 2020

@cheenamalhotra Thank you! I will look forward to a fix from the ef core package :) but at least right now there is a work-around by forcing Microsoft.Data.SqlClient into the project along with the sql server ef core package.

To sum up, the entity framework core sql server nuget needs to reference the 2.1.0 sql client package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants