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

Any reason installing SqlClient should bring WebView2? #2298

Closed
R2D221 opened this issue Jan 16, 2024 · 14 comments
Closed

Any reason installing SqlClient should bring WebView2? #2298

R2D221 opened this issue Jan 16, 2024 · 14 comments
Labels
🔗 External Issue is in an external component

Comments

@R2D221
Copy link

R2D221 commented Jan 16, 2024

Describe the bug

I just updated the Microsoft.Data.SqlClient package to version 5.1.4. After that, in the list of transitive packages it shows the following:

Microsoft.Web.WebView2 by Microsoft
Transitively referenced version 1.0.864.35 by
Microsoft.Data.SqlClient.5.1.4

To reproduce

Just install Microsoft.Data.SqlClient 5.1.4 in a console project.

Expected behavior

A GUI component shouldn't be part of the dependencies for a database library.

Further technical details

Microsoft.Data.SqlClient version: 5.1.4
.NET target: 8.0
SQL Server version: -
Operating system: Windows 10 21H2

Additional context
Add any other context about the problem here.

@ErikEJ
Copy link
Contributor

ErikEJ commented Jan 16, 2024

Is the WebView2 dll included when you publish the app. It comes from Azure.Identity, but only when targeting net6.0-windows7.0

https://www.nuget.org/packages/Microsoft.Identity.Client/

@R2D221
Copy link
Author

R2D221 commented Jan 16, 2024

  1. It does, it outputs the following DLLS:
    • Microsoft.Web.WebView2.Core.dll
    • Microsoft.Web.WebView2.WinForms.dll
    • Microsoft.Web.WebView2.Wpf.dll
  2. Even then, I still have some projects in .NET 6. WebView2 shouldn't be included in them either.

@JRahnama
Copy link
Contributor

I just created a sample application with net8 and was not able to see that reference. As @ErikEJ has mentioned it will be mapped when targeting net6.0-windows7.0. Can you share the csproj?

image

@JRahnama JRahnama added the 🆕 Triage Needed For new issues, not triaged yet. label Jan 16, 2024
@R2D221
Copy link
Author

R2D221 commented Jan 16, 2024

The csproj only has <TargetFramework>net8.0-windows</TargetFramework> and the dependencies, but I think the real reason is that some of my project references (common libraries for all our projects) are targeting net6.0-windows and also use Microsoft.Data.SqlClient.

@ErikEJ
Copy link
Contributor

ErikEJ commented Jan 16, 2024

@R2D221 what if you target net8.0 ONLY?

@R2D221
Copy link
Author

R2D221 commented Jan 16, 2024

Give me a moment and I'll test it

@R2D221
Copy link
Author

R2D221 commented Jan 16, 2024

With this project I first had issue with, I moved ALL dependencies to net8.0-windows (can't remove Windows since I do indeed use Windows-specific code), and WebView2 is still present.

So, I'm making a new test project:

With net8.0 (NOT windows):

image

With net8.0-windows:

image

@ErikEJ
Copy link
Contributor

ErikEJ commented Jan 16, 2024

This seems to be by design...

@R2D221
Copy link
Author

R2D221 commented Jan 16, 2024

What is by design? Bring a GUI dependency on my console project? I don't think I follow

@ErikEJ
Copy link
Contributor

ErikEJ commented Jan 16, 2024

If it was a true console project you would not need net8.0-windows

@R2D221
Copy link
Author

R2D221 commented Jan 16, 2024

I have a dependency on System.DirectoryServices for some Active Directory stuff. That still doesn't invoke any UI of any kind, but the package gives warnings about the only supported platform being Windows, so I made my project Windows-only.

@R2D221
Copy link
Author

R2D221 commented Jan 16, 2024

But anyway, even when I'm using SqlClient on WPF projects, I still don't need the WebView2 component since I'm not showing any HTML stuff.

@AdaskoTheBeAsT
Copy link

same situation is with System.Drawing.Common

Microsoft.Data.SqlClient is dependant on System.Runtime.Caching which is dependant on System.Configuration.ConfigurationManager which is dependant on System.Security.Permissions which is dependant on System.Windows.Extensions which is dependant on System.Drawing.Common

it is only db driver
please use AI to sort out dependencies

@kf-gonzalez kf-gonzalez removed the 🆕 Triage Needed For new issues, not triaged yet. label Jan 17, 2024
@DavoudEshtehari DavoudEshtehari added the 🔗 External Issue is in an external component label Jan 17, 2024
@David-Engel
Copy link
Contributor

Microsoft.Identity.Client is MSAL. It provides AAD authentication, including interactive auth. I'd guess those libraries are included to provide a nicer interactive experience on Windows and/or WAM integration, versus the typical browser popup implementation. This dependency chain isn't something we have control over in MDS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔗 External Issue is in an external component
Projects
Development

No branches or pull requests

7 participants