Skip to content

[Problem/Bug]: Webview2 nuget package inclusion in referencED project pollutes the output directory of all referencING projects #5326

@AbominableIntelligence

Description

@AbominableIntelligence

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

  1. Create a blank solution
  2. Add a windows control library project (PluginDll)
  3. Add a windows control library project (UtilityDll)
  4. Modify the output directory of PluginDll so that it outputs to a subfolder
  5. Add UtilityDll as a project reference to PluginDll
  6. Build - the output directory of PluginDll will only contain its dll and ancilleries as expected.
  7. Add the Webview Nuget package to UtilityDll
  8. Build - now the output directory of PluginDll will be polluted by the webview2 stuff.
  9. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions