dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.21k stars 4.72k forks source link

dotnet publish with reference to `Microsoft.Data.SqlClient` 5.1.1 causes NETSDK1152 for Microsoft.Web. WebView2.Core.dll #92676

Open msschl opened 1 year ago

msschl commented 1 year ago

Description

Publishing a dotnet maui app with a reference to Microsoft.Data.SqlClient version 5.1.1 either through Miicrosoft.EntityFrameworkCore.SqlServer or the Microsoft.Data.SqlClient package directly causes an error for Microsoft.Web. WebView2.Core.dll. NETSDK1152

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.0-rc.1.9171

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

Downgrading to a version that references Microsoft.Data.SqlClient version 4.1.1 fixes the issue. I.e., using Microsoft.EntityFrameworkCore.SqlServer version 6.0.22

Relevant log output

C:\Program Files\dotnet\sdk\8.0.100-rc.1.23463.5\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ConflictResolution.targets(112,5): error NETSDK1152: Es wurden mehrere Ausgabedateien für die Veröffentlichung mit demselben relativen Pfad gef unden: W:\src\Tools\Company\src\Company.XYZ.MAUI.Project\obj\Release\net8.0-windows10.0.19041.0\win10-x64\MsixContent\Microsoft.Web.WebView2.Core.dll, obj\Release\net8.0-windows10.0.19041.0\win10-x64\R2R\Microsoft.Web. WebView2.Core.dll. [W:\src\Tools\Company\src\Company.XYZ.MAUI.Project\Company.XYZ.MAUI.Project::TargetFramework=net8.0-windows10.0.19041.0]
ghost commented 1 year ago

Tagging subscribers to this area: @davoudeshtehari, @david-engel, @jrahnama See info in area-owners.md if you want to be subscribed.

Issue Details
### Description Publishing a dotnet maui app with a reference to `Microsoft.Data.SqlClient` version 5.1.1 either through `Miicrosoft.EntityFrameworkCore.SqlServer` or the `Microsoft.Data.SqlClient` package directly causes an error for Microsoft.Web. WebView2.Core.dll. NETSDK1152 ### Steps to Reproduce _No response_ ### Link to public reproduction project repository _No response_ ### Version with bug 8.0.0-rc.1.9171 ### Is this a regression from previous behavior? Yes, this used to work in .NET MAUI ### Last version that worked well Unknown/Other ### Affected platforms Windows ### Affected platform versions _No response_ ### Did you find any workaround? Downgrading to a version that references `Microsoft.Data.SqlClient` version 4.1.1 fixes the issue. I.e., using `Microsoft.EntityFrameworkCore.SqlServer` version 6.0.22 ### Relevant log output ```shell C:\Program Files\dotnet\sdk\8.0.100-rc.1.23463.5\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ConflictResolution.targets(112,5): error NETSDK1152: Es wurden mehrere Ausgabedateien für die Veröffentlichung mit demselben relativen Pfad gef unden: W:\src\Tools\Company\src\Company.XYZ.MAUI.Project\obj\Release\net8.0-windows10.0.19041.0\win10-x64\MsixContent\Microsoft.Web.WebView2.Core.dll, obj\Release\net8.0-windows10.0.19041.0\win10-x64\R2R\Microsoft.Web. WebView2.Core.dll. [W:\src\Tools\Company\src\Company.XYZ.MAUI.Project\Company.XYZ.MAUI.Project::TargetFramework=net8.0-windows10.0.19041.0] ```
Author: msschl
Assignees: -
Labels: `area-System.Data.SqlClient`, `untriaged`, `needs-area-label`
Milestone: -
David-Engel commented 1 year ago

Did this work in a previous version of .NET? Can you provide a sample project?

msschl commented 11 months ago

Here is a sample project. https://github.com/msschl/bug_maui_efcore_92676

It just is a plain new .net maui blazor hybrid project with ef core 8.0 added. It is able to build and run. But publishing with otnet publish -f net8.0-windows10.0.19041.0 -p:WindowsPackageType=None MauiApp1\MauiApp1.csproj will result in the error as described in this issue.

msschl commented 11 months ago

Also still not working in the new net 8.0 release with maui 8.0.3