MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
453 stars 55 forks source link

[Problem/Bug]: Unneeded references keep appearing in Visual Studio Solutions Explorer causing Warnings in Error List #4812

Closed mikemeinz closed 3 weeks ago

mikemeinz commented 2 months ago

What happened?

This problem exists with both WebView2 SDK 1.0.2651.64 and SDK 1.0.2739.15. The problem also exists with pre-release version SDK 1.0.2783-prerelease. The problem does not exist with SDK 1.0.2592.51.

I am using Microsoft.Web.WebView2 NuGet package with my .NET Framework 4.8.1 VB .NET project. This project has existed since WebView2 was first released.

Since the last two WebView2 SDK stable releases, references to .net6.0 and netcoreapp3.0 WebView2 libraries have been automatically added to my project when the Solution is opened in Visual Studio. If I remove them from VS Solutions Explorer, they re-appear upon re-opening the Solution. If I uninstall Microsoft.Web.WebView2 NuGet package and re-install it, these references re-appear. The items in the Error List are warnings so do not prevent compilation but they do take space in the Error List.

These references have started showing in the VS 2022 Solutions Explorer:

C:\Users\<username>\.nuget\packages\microsoft.web.webview2\1.0.2739.15\build\..\\lib_manual\net6.0-windows10.0.17763.0\Microsoft.Web.WebView2.Core.Projection.dll
C:\Users\<username>\.nuget\packages\microsoft.web.webview2\1.0.2739.15\build\..\\lib_manual\netcoreapp3.0\Microsoft.Web.WebView2.Core.dll
C:\Users\<username>\.nuget\packages\microsoft.web.webview2\1.0.2739.15\build\..\\lib_manual\netcoreapp3.0\Microsoft.Web.WebView2.WinForms.dll
C:\Users\<username>\.nuget\packages\microsoft.web.webview2\1.0.2739.15\build\..\\lib_manual\netcoreapp3.0\Microsoft.Web.WebView2.Wpf.dll

These warning messages are displayed in the VS Error List window

Severity    Code    Description Project File    Line    Suppression State
Warning     The referenced component 'C:\Users\<username>\.nuget\packages\microsoft.web.webview2\1.0.2739.15\build\..\\lib_manual\netcoreapp3.0\Microsoft.Web.WebView2.WinForms.dll' could not be found.    VideoPlayerManager          
Warning     The referenced component 'C:\Users\<username>\.nuget\packages\microsoft.web.webview2\1.0.2739.15\build\..\\lib_manual\net6.0-windows10.0.17763.0\Microsoft.Web.WebView2.Core.Projection.dll' could not be found.    VideoPlayerManager          
Warning     The referenced component 'C:\Users\<username>\.nuget\packages\microsoft.web.webview2\1.0.2739.15\build\..\\lib_manual\netcoreapp3.0\Microsoft.Web.WebView2.Core.dll' could not be found.    VideoPlayerManager          
Warning     The referenced component 'C:\Users\<username>\.nuget\packages\microsoft.web.webview2\1.0.2739.15\build\..\\lib_manual\netcoreapp3.0\Microsoft.Web.WebView2.Wpf.dll' could not be found. VideoPlayerManager

Importance

Low. My app is not very affected, or this only affects development.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

128.0.2739.79

SDK Version

1.0.2651.64, 1.0.2739.15, SDK 1.0.2783-prerelease

Framework

Winforms

Operating System

Windows 11

OS Version

22631.3880

Repro steps

Open the Solution in Visual Studio 2022 and the extra references re-appear.


Visual Studio Installed Products:

Microsoft Visual Studio Community 2022 Version 17.11.3 VisualStudio.17.Release/17.11.3+35303.130

Microsoft .NET Framework Version 4.8.09032

Installed Version: Community

ASP.NET and Web Tools 17.11.231.19466 ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.11.231.19466 Azure App Service Tools v3.0.0

C# Tools 4.11.0-3.24428.4+1ea9c390a5bb6815fdff2137ee155e23e78d6ff3 C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Code Converter 1.0 Code Converter Extension Details

Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GitHub Copilot 0.2.1648.49400 GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

IndentRainbowPackage Extension 1.0 IndentRainbowPackage Visual Studio Extension Detailed Info

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

MSBuild Editor 2.9.524+91c41270f3 Language service for MSBuild projects and targets

Node.js Tools 1.5.60329.1 Commit Hash:15fce86a17f9f33e5bd7ca7ccb9b216aff149252 Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager 6.11.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Rainbow Braces 1.0.164 Colorizes matching brace pairs to make it easy to identify them and their scope. Works for curly brackets, parentheses, and square brackets.

Razor (ASP.NET Core) 17.11.3.2442001+68650a7d94261bc56a1f4bc522c2ee35314b1abb Provides languages services for ASP.NET Core Razor.

RunCommand Extension 1.0 RunCommand Visual Studio Extension Detailed Info

SQL Server Data Tools 17.11.38.0 Microsoft SQL Server Data Tools

TypeScript Tools 17.0.30715.2002 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.11.0-3.24428.4+1ea9c390a5bb6815fdff2137ee155e23e78d6ff3 Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.11.0-beta.24421.7+af2f522de602281d4ef5a7b71507c428e814c5c1 Microsoft Visual F# Tools

Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Regression in newer SDK

Last working version (if regression)

1.0.2592.51

AB#54162282

frank-hoffman commented 1 month ago

I was just about to submit this same issue. I'm seeing the same thing from a VSTO Word add-in that targets .NET Framework 4.8.

oggy22 commented 1 month ago

Hi @mikemeinz , thank you for reporting the issue. This is probably caused by some recent SDK refactoring to support WinRT C# projection. We will take a look.

rozeboosje commented 1 month ago

Yes that does look like the same issue. Thank you.

ShaunLoganOracle commented 1 month ago

+1 : We are seeing the same issue from a VSTO Excel add-in targeting .NET Framework 4.8. Details.

ShaunLoganOracle commented 1 month ago

In case it helps, the missing files are present under lib_manual. For example, one of the warnings I see is:

The referenced component '%userprofile%\.nuget\packages\microsoft.web.webview2\1.0.2739.15\build\..\\lib_manual\netcoreapp3.0\Microsoft.Web.WebView2.Wpf.dll' could not be found.

(I replaced my user with %userprofile%). Note the double \\ before \\lib_manual. In a command prompt, I can do a dir and find the missing file - even when including the \\:

C:\>dir /b %userprofile%\.nuget\packages\microsoft.web.webview2\1.0.2739.15\build\..\\lib_manual\netcoreapp3.0\Microsoft.Web.WebView2.Wpf.dll
Microsoft.Web.WebView2.Wpf.dll
rozeboosje commented 1 month ago

If I understand it correctly it shouldn't even be looking for those files. Those are references to versions of DLLs that are needed in solutions for .NET Core, not .NET Framework 4.8 and they should not be included in nuget packages targeting .NET Framework 4.8

mikemeinz commented 4 weeks ago

Although not mentioned in the Release Notes, this issue appears to be resolved in version 1.0.2849.39. I removed the un-needed references. Saved and reloaded the solution. Rebuilt the app. The un-needed references did not re-appear.

Thank You!

oggy22 commented 3 weeks ago

Thank you @mikemeinz ! I am closing this issue.