MicrosoftEdge / MicrosoftEdge/WebView2Feedback
[Problem/Bug]: Webview2 nuget package inclusion in referencED project pollutes the output directory of all referencING projects
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
What happened?
Hi there,
Whenever you add the Webview2 nuget package to a solution project that is referenced by any other projects in the solution, the output folders of the latter are polluted by the webview2 dlls and runtimes subfolder REGARDLESS of Copylocal.
VS2022 Community Edition
.NET 8
Webview version 1.0.3351.48
Windows 11
I have a C# solution containing a Winforms exe project, a "Utility.dll" project, and a number of other projects that act as plugins, that is, they are dynamically loaded at runtime from a "Plugins" subfolder. To this end, each of the plugin dll's has a target subdirectory like so:
<OutputPath>$(SolutionDir)bin\$(Configuration)\Plugins\</OutputPath>
This works and my module loader can simply iterate through the DLLs in the Plugins folder, but this of course requires that there are no stray Dlls.
I wanted to add embedded HTML help to each of the plugins, and to this end I imported the WebView2 nuget package into Utility.csproj and created a UserControl containing a webview control to use in each of the plugins, but now every one of plugin dlls has an unremovable assembly dependency on the three webview assemblies (core, winforms and wpf), with the respective dlls being copied to the Plugins folder (incluing the runtimes folder) regardless of Copylocal being false either on the project dependency or the three assembly dependencies.
This is driving me nuts and the only way forward seems to be to run some sort of post-build event to manually delete the offending files. I am sitting at 17 plugins atm so this is a bit of a pita.
I don't know if there are any quickfixes for this, but right now I'm on the cusp of abandoning the imbedded HTML help idea unless I can find an alternative embeddable browser.
Thank you.
Importance
Important. My app's user experience is significantly compromised.
Runtime Channel
Stable release (WebView2 Runtime)
Runtime Version
1.0.3351.48
SDK Version
No response
Framework
Winforms
Operating System
Windows 11
OS Version
10.0.26100
Repro steps
- Create a blank solution
- Add a windows control library project (PluginDll)
- Add a windows control library project (UtilityDll)
- Modify the output directory of PluginDll so that it outputs to a subfolder
- Add UtilityDll as a project reference to PluginDll
- Build - the output directory of PluginDll will only contain its dll and ancilleries as expected.
- Add the Webview Nuget package to UtilityDll
- Build - now the output directory of PluginDll will be polluted by the webview2 stuff.
- Fiddle with Copylocal and sat assembly settings to no avail while your tooth enamel is slowly eroded.
Repros in Edge Browser
No, issue does not reproduce in the corresponding Edge version
Regression
No, this never worked
Last working version (if regression)
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior using the blank solution described, with PluginDll and UtilityDll project files and PluginDll's custom OutputPath. First compare the output before and after adding the WebView2 NuGet package to UtilityDll, including the runtimes folder and WebView2 assemblies. Done means referenced plugin output directories contain only their expected plugin files despite the WebView2 dependency settings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100