MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: NuGet package Microsoft.Web.WebView2 build files do not work in some MsBuild scenarios

Open
#4,923 7 comments 0 reactions 1 assignee View on GitHub

@ambikakunnath is already working on this.

Since Nov 13, 2024.

bug regression
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

What happened?

Building a CSPROJ with MSBuild does not work when the targets restore and Build are called in the same MSBuild run.

The error was introduced with the new non-standard NuGet structure.

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

1.0.2849.39

Framework

Winforms

Operating System

Windows 10

OS Version

No response

Repro steps

Create a sample project:

dotnet new classlib -f net8.0 -o WebView2Test
cd .\WebView2Test\
dotnet add package Microsoft.Web.WebView2

Add a Test.cs file:

namespace WebView2Test;

using Microsoft.Web.WebView2.Core;

public class Test
{
    public static async Task Initialize()
    {
        await CoreWebView2Environment.CreateAsync();
    }
}

Build using this command:

msbuild /T:"restore;Build" .\WebView2Test.csproj

Result (sorry, machine has German culture):

error CS0234: Der Typ- oder Namespacename "Web" ist im Namespace "Microsoft" nicht vorhanden. (Möglicherweise fehlt ein Assemblyverweis.)
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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.