msbuild: MSBuild does not resolve WindowsBase correctly

Describe the bug

I am working with third-party components (DevExpress) and their new release based on .NET 6 appears to have exposed a potential bug in MSBuild’s assembly resolution logic. There appears to be a versioning conflict between two WindowsBase DLLs in the WindowsDesktop and NETCore SDKs. For further details, please see this public support ticket. In particular, this reply.

The issue applies to both .NET 6 and .NET 7 WindowsDesktop projects.

To Reproduce

Here is a sample project you can build to reproduce. Just build it and look in the Visual Studio build output to see the below lines.

Exceptions (if any)

1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277: Found conflicts between different versions of "WindowsBase" that could not be resolved.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277: There was a conflict between "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "WindowsBase, Version=6.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277:     "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "WindowsBase, Version=6.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277:     References which depend on "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\7.0.1\ref\net7.0\WindowsBase.dll].
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277:         C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\7.0.1\ref\net7.0\WindowsBase.dll
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277:           Project file item includes which caused reference "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\7.0.1\ref\net7.0\WindowsBase.dll".
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277:             C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\7.0.1\ref/net7.0/WindowsBase.dll
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277:     References which depend on "WindowsBase, Version=6.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [].
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277:         C:\Users\Eaton\Source\Repos\WinFormsApp1\WinFormsApp1\DevExpress.Data.Desktop.v22.2.dll
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277:           Project file item includes which caused reference "C:\Users\Eaton\Source\Repos\WinFormsApp1\WinFormsApp1\DevExpress.Data.Desktop.v22.2.dll".
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2352,5): warning MSB3277:             DevExpress.Data.Desktop.v22.2

Further technical details

  • Include the output of dotnet --info:
.NET SDK:
 Version:   7.0.101
 Commit:    bb24aafa11

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.22621
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\7.0.101\

Host:
  Version:      7.0.1
  Architecture: x64
  Commit:       97203d38ba

.NET SDKs installed:
  6.0.202 [C:\Program Files\dotnet\sdk]
  7.0.101 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
  • The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version Visual Studio 2022 Version 17.4.3 (Windows)

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 10
  • Comments: 28

Most upvoted comments

@dedale Yeah, I checked that file earlier… These errors are preventing me from publishing my app to the MS Store ): @sir-wilhelm Indeed, in 1.0.2792.45, this issue is not present. Interesting.

Version Warning Error
1.0.2903.40 ✅ ✅
1.0.2849.39 ✅ ✅
1.0.2792.45 ❌ ✅
1.0.2739.15 ❌ ❌

1.0.2739.15 is the only good version that does not cause any warnings or errors.

Warning

Found conflicts between different versions of "WindowsBase" that could not be resolved.
There was a conflict between "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
    "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.

Error (with Windows Application Packaging Project)

The processor architecture of the project being built "Any CPU" is not supported by the referenced SDK "Microsoft.VCLibs.Desktop, Version=14.0". Please consider changing the targeted processor architecture of your project (in Visual Studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, x64, ARM, ARM64".

@dedale I’ve identified that the issue is caused by Microsoft.Web.WebView2 starting from version >1.0.2739.15. Currently, I am using an older version.

This was helpful, but in my case I was able to get rid of the mass of build warnings by flipping Microsoft.Web.WebView2 from 1.0.2849.39 to 1.0.2792.45.

I actually fixed this with

<UseWPF>true</UseWPF>

最新稳定版 1.0.3296.44

重新生成开始于 16:21… 已还原 C:\Users\steve\Downloads\Webview2Aot-main\Webview2Aot-main\src\WinForm\WinTest\WinTest.csproj (用时 11 毫秒)。 1>------ 已启动全部重新生成: 项目: WinTest, 配置: Debug x64 ------ 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2434,5): warning MSB3277: 发现无法解析的“WindowsBase”的不同版本之间存在冲突。 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2434,5): warning MSB3277: “WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”与“WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”之间存在冲突。 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2434,5): warning MSB3277: 已选择“WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”,因为它是主版本而“WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”不是。 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2434,5): warning MSB3277: 依赖于“WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”[C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\9.0.5\ref\net9.0\WindowsBase.dll]的引用。 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2434,5): warning MSB3277: C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\9.0.5\ref\net9.0\WindowsBase.dll 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2434,5): warning MSB3277: 导致引用“C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\9.0.5\ref\net9.0\WindowsBase.dll”的项目文件项 Include 特性。 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2434,5): warning MSB3277: C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\9.0.5\ref/net9.0/WindowsBase.dll 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2434,5): warning MSB3277: 依赖于或已统一到“WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35”[] 的引用。 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2434,5): warning MSB3277: C:\Users\steve.nuget\packages\microsoft.web.webview2\1.0.3296.44\lib_manual\net5.0-windows10.0.17763.0\Microsoft.Web.WebView2.Wpf.dll 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2434,5): warning MSB3277: 导致引用“C:\Users\steve.nuget\packages\microsoft.web.webview2\1.0.3296.44\lib_manual\net5.0-windows10.0.17763.0\Microsoft.Web.WebView2.Wpf.dll”的项目文件项 Include 特性。 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2434,5): warning MSB3277: C:\Users\steve.nuget\packages\microsoft.web.webview2\1.0.3296.44\buildTransitive..\lib_manual\net5.0-windows10.0.17763.0\Microsoft.Web.WebView2.Wpf.dll 1>WinTest -> C:\Users\steve\Downloads\Webview2Aot-main\Webview2Aot-main\src\WinForm\WinTest\bin\x64\Debug\net9.0-windows\WinTest.dll 1>已完成生成项目“WinTest.csproj”的操作。 ========== 全部重新生成: 1 成功,0 失败,0 已跳过 ========== ========== 重新生成 于 16:21 完成,耗时 00.644 秒 ==========

The latest version of Microsoft.Web.WebView2 1.0.3296.44 still produces the warning, so I’ll be sticking with 1.0.2792.45 for now.

Microsoft.Web.WebView2最新版是1.0.3296.44,把版本降到1.0.2792.45,这个警告就消除了,具体原因未知。

重新生成开始于 16:25… 1>------ 已启动全部重新生成: 项目: WinTest, 配置: Debug x64 ------ 已还原 C:\Users\steve\Downloads\Webview2Aot-main\Webview2Aot-main\src\WinForm\WinTest\WinTest.csproj (用时 10 毫秒)。 1>WinTest -> C:\Users\steve\Downloads\Webview2Aot-main\Webview2Aot-main\src\WinForm\WinTest\bin\x64\Debug\net9.0-windows\WinTest.dll ========== 全部重新生成: 1 成功,0 失败,0 已跳过 ========== ========== 重新生成 于 16:25 完成,耗时 00.873 秒 ==========

这个示例项目来自 https://github.com/shshshdy/Webview2Aot的

@Paul-Williams I first noticed the build warning starting with 1.0.2849.39, so I went back to 1.0.2792.45 to get rid of the warning. I can’t say I’ve run into the error others have.

It should be easy for you to try 1.0.2792.45 in your project/solution and run a build to see.

Dropping back to v1.0.2739.15 removed this warning for me also. Thanks

Updgrade the project

@sefinek well sorry, it seems project.assets.json files are not helpful in your case to identify the source of the conflict 😒

@dedale

obj/project.assets.json (Microsoft.Web.WebView2/1.0.2849.39)
{
  "version": 3,
  "targets": {
    "net8.0-windows7.0": {
      "Microsoft.Web.WebView2/1.0.2849.39": {
        "type": "package",
        "build": {
          "buildTransitive/Microsoft.Web.WebView2.targets": {}
        },
        "runtimeTargets": {
          "runtimes/win-arm64/native/WebView2Loader.dll": {
            "assetType": "native",
            "rid": "win-arm64"
          },
          "runtimes/win-x64/native/WebView2Loader.dll": {
            "assetType": "native",
            "rid": "win-x64"
          },
          "runtimes/win-x86/native/WebView2Loader.dll": {
            "assetType": "native",
            "rid": "win-x86"
          }
        }
      },
      "Newtonsoft.Json/13.0.3": {
        "type": "package",
        "compile": {
          "lib/net6.0/Newtonsoft.Json.dll": {
            "related": ".xml"
          }
        },
        "runtime": {
          "lib/net6.0/Newtonsoft.Json.dll": {
            "related": ".xml"
          }
        }
      }
    }
  },
  "libraries": {
    "Microsoft.Web.WebView2/1.0.2849.39": {
      "sha512": "mWyurCfuOGF2odk+Orflzpk017oBmLy11qiQTXpcc9ZWqhx2SfYDr2izplyxy2bCkWDSXCQpBDhU5u9+mhHlDQ==",
      "type": "package",
      "path": "microsoft.web.webview2/1.0.2849.39",
      "hasTools": true,
      "files": [
        ".nupkg.metadata",
        ".signature.p7s",
        "LICENSE.txt",
        "NOTICE.txt",
        "WebView2.idl",
        "WebView2.tlb",
        "build/Common.targets",
        "build/Microsoft.Web.WebView2.targets",
        "build/WebView2Rules.Project.xml",
        "build/native/Microsoft.Web.WebView2.targets",
        "build/native/arm64/WebView2Loader.dll",
        "build/native/arm64/WebView2Loader.dll.lib",
        "build/native/arm64/WebView2LoaderStatic.lib",
        "build/native/include-winrt/WebView2Interop.h",
        "build/native/include-winrt/WebView2Interop.idl",
        "build/native/include-winrt/WebView2Interop.tlb",
        "build/native/include/WebView2.h",
        "build/native/include/WebView2EnvironmentOptions.h",
        "build/native/x64/WebView2Loader.dll",
        "build/native/x64/WebView2Loader.dll.lib",
        "build/native/x64/WebView2LoaderStatic.lib",
        "build/native/x86/WebView2Loader.dll",
        "build/native/x86/WebView2Loader.dll.lib",
        "build/native/x86/WebView2LoaderStatic.lib",
        "build/wv2winrt.targets",
        "buildTransitive/Microsoft.Web.WebView2.targets",
        "lib/Microsoft.Web.WebView2.Core.winmd",
        "lib/net462/Microsoft.Web.WebView2.Core.dll",
        "lib/net462/Microsoft.Web.WebView2.Core.xml",
        "lib/net462/Microsoft.Web.WebView2.WinForms.dll",
        "lib/net462/Microsoft.Web.WebView2.WinForms.xml",
        "lib/net462/Microsoft.Web.WebView2.Wpf.dll",
        "lib/net462/Microsoft.Web.WebView2.Wpf.xml",
        "lib_manual/net5.0-windows10.0.17763.0/Microsoft.Web.WebView2.Wpf.dll",
        "lib_manual/net5.0-windows10.0.17763.0/Microsoft.Web.WebView2.Wpf.xml",
        "lib_manual/net6.0-windows10.0.17763.0/Microsoft.Web.WebView2.Core.Projection.dll",
        "lib_manual/net8.0-windows10.0.17763.0/Microsoft.Web.WebView2.Core.Projection.dll",
        "lib_manual/netcoreapp3.0/Microsoft.Web.WebView2.Core.dll",
        "lib_manual/netcoreapp3.0/Microsoft.Web.WebView2.Core.xml",
        "lib_manual/netcoreapp3.0/Microsoft.Web.WebView2.WinForms.dll",
        "lib_manual/netcoreapp3.0/Microsoft.Web.WebView2.WinForms.xml",
        "lib_manual/netcoreapp3.0/Microsoft.Web.WebView2.Wpf.dll",
        "lib_manual/netcoreapp3.0/Microsoft.Web.WebView2.Wpf.xml",
        "microsoft.web.webview2.1.0.2849.39.nupkg.sha512",
        "microsoft.web.webview2.nuspec",
        "runtimes/win-arm64/native/WebView2Loader.dll",
        "runtimes/win-arm64/native_uap/Microsoft.Web.WebView2.Core.dll",
        "runtimes/win-x64/native/WebView2Loader.dll",
        "runtimes/win-x64/native_uap/Microsoft.Web.WebView2.Core.dll",
        "runtimes/win-x86/native/WebView2Loader.dll",
        "runtimes/win-x86/native_uap/Microsoft.Web.WebView2.Core.dll",
        "tools/VisualStudioToolsManifest.xml",
        "tools/wv2winrt/Antlr3.Runtime.dll",
        "tools/wv2winrt/Antlr4.StringTemplate.dll",
        "tools/wv2winrt/System.Buffers.dll",
        "tools/wv2winrt/System.CommandLine.DragonFruit.dll",
        "tools/wv2winrt/System.CommandLine.Rendering.dll",
        "tools/wv2winrt/System.CommandLine.dll",
        "tools/wv2winrt/System.Memory.dll",
        "tools/wv2winrt/System.Numerics.Vectors.dll",
        "tools/wv2winrt/System.Runtime.CompilerServices.Unsafe.dll",
        "tools/wv2winrt/codegen_util.dll",
        "tools/wv2winrt/concrt140_app.dll",
        "tools/wv2winrt/cs/System.CommandLine.resources.dll",
        "tools/wv2winrt/de/System.CommandLine.resources.dll",
        "tools/wv2winrt/es/System.CommandLine.resources.dll",
        "tools/wv2winrt/fr/System.CommandLine.resources.dll",
        "tools/wv2winrt/it/System.CommandLine.resources.dll",
        "tools/wv2winrt/ja/System.CommandLine.resources.dll",
        "tools/wv2winrt/ko/System.CommandLine.resources.dll",
        "tools/wv2winrt/msvcp140_1_app.dll",
        "tools/wv2winrt/msvcp140_2_app.dll",
        "tools/wv2winrt/msvcp140_app.dll",
        "tools/wv2winrt/pl/System.CommandLine.resources.dll",
        "tools/wv2winrt/pt-BR/System.CommandLine.resources.dll",
        "tools/wv2winrt/ru/System.CommandLine.resources.dll",
        "tools/wv2winrt/tr/System.CommandLine.resources.dll",
        "tools/wv2winrt/type_hierarchy.dll",
        "tools/wv2winrt/vcamp140_app.dll",
        "tools/wv2winrt/vccorlib140_app.dll",
        "tools/wv2winrt/vcomp140_app.dll",
        "tools/wv2winrt/vcruntime140_app.dll",
        "tools/wv2winrt/winrt_winmd.dll",
        "tools/wv2winrt/winrt_winmd.winmd",
        "tools/wv2winrt/wv2winrt.exe",
        "tools/wv2winrt/wv2winrt.exe.config",
        "tools/wv2winrt/wv2winrt.xml",
        "tools/wv2winrt/zh-Hans/System.CommandLine.resources.dll",
        "tools/wv2winrt/zh-Hant/System.CommandLine.resources.dll"
      ]
    },
    "Newtonsoft.Json/13.0.3": {
      "sha512": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==",
      "type": "package",
      "path": "newtonsoft.json/13.0.3",
      "files": [
        ".nupkg.metadata",
        ".signature.p7s",
        "LICENSE.md",
        "README.md",
        "lib/net20/Newtonsoft.Json.dll",
        "lib/net20/Newtonsoft.Json.xml",
        "lib/net35/Newtonsoft.Json.dll",
        "lib/net35/Newtonsoft.Json.xml",
        "lib/net40/Newtonsoft.Json.dll",
        "lib/net40/Newtonsoft.Json.xml",
        "lib/net45/Newtonsoft.Json.dll",
        "lib/net45/Newtonsoft.Json.xml",
        "lib/net6.0/Newtonsoft.Json.dll",
        "lib/net6.0/Newtonsoft.Json.xml",
        "lib/netstandard1.0/Newtonsoft.Json.dll",
        "lib/netstandard1.0/Newtonsoft.Json.xml",
        "lib/netstandard1.3/Newtonsoft.Json.dll",
        "lib/netstandard1.3/Newtonsoft.Json.xml",
        "lib/netstandard2.0/Newtonsoft.Json.dll",
        "lib/netstandard2.0/Newtonsoft.Json.xml",
        "newtonsoft.json.13.0.3.nupkg.sha512",
        "newtonsoft.json.nuspec",
        "packageIcon.png"
      ]
    }
  },
  "projectFileDependencyGroups": {
    "net8.0-windows7.0": [
      "Microsoft.Web.WebView2 >= 1.0.2849.39",
      "Newtonsoft.Json >= 13.0.3"
    ]
  },
  "packageFolders": {
    "C:\\Users\\Sefinek\\.nuget\\packages\\": {},
    "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
  },
  "project": {
    "version": "1.0.3",
    "restore": {
      "projectUniqueName": "D:\\Projects\\apps\\Sefinek-Blocklists-App\\SefinekBlocklists\\Sefinek Blocklists App.csproj",
      "projectName": "Sefinek Blocklists",
      "projectPath": "D:\\Projects\\apps\\Sefinek-Blocklists-App\\SefinekBlocklists\\Sefinek Blocklists App.csproj",
      "packagesPath": "C:\\Users\\Sefinek\\.nuget\\packages\\",
      "outputPath": "D:\\Projects\\apps\\Sefinek-Blocklists-App\\SefinekBlocklists\\obj\\",
      "projectStyle": "PackageReference",
      "fallbackFolders": [
        "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
      ],
      "configFilePaths": [
        "C:\\Users\\Sefinek\\AppData\\Roaming\\NuGet\\NuGet.Config",
        "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
        "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
      ],
      "originalTargetFrameworks": [
        "net8.0-windows"
      ],
      "sources": {
        "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
        "https://api.nuget.org/v3/index.json": {}
      },
      "frameworks": {
        "net8.0-windows7.0": {
          "targetAlias": "net8.0-windows",
          "projectReferences": {}
        }
      },
      "warningProperties": {
        "warnAsError": [
          "NU1605"
        ]
      },
      "restoreAuditProperties": {
        "enableAudit": "true",
        "auditLevel": "low",
        "auditMode": "direct"
      }
    },
    "frameworks": {
      "net8.0-windows7.0": {
        "targetAlias": "net8.0-windows",
        "dependencies": {
          "Microsoft.Web.WebView2": {
            "target": "Package",
            "version": "[1.0.2849.39, )"
          },
          "Newtonsoft.Json": {
            "target": "Package",
            "version": "[13.0.3, )"
          }
        },
        "imports": [
          "net461",
          "net462",
          "net47",
          "net471",
          "net472",
          "net48",
          "net481"
        ],
        "assetTargetFallback": true,
        "warn": true,
        "frameworkReferences": {
          "Microsoft.NETCore.App": {
            "privateAssets": "all"
          },
          "Microsoft.WindowsDesktop.App.WindowsForms": {
            "privateAssets": "none"
          }
        },
        "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.403/PortableRuntimeIdentifierGraph.json"
      }
    }
  }
}
obj/project.assets.json (Microsoft.Web.WebView2/1.0.2739.15)
{
  "version": 3,
  "targets": {
    "net8.0-windows7.0": {
      "Microsoft.Web.WebView2/1.0.2739.15": {
        "type": "package",
        "build": {
          "build/Microsoft.Web.WebView2.targets": {}
        },
        "runtimeTargets": {
          "runtimes/win-arm64/native/WebView2Loader.dll": {
            "assetType": "native",
            "rid": "win-arm64"
          },
          "runtimes/win-x64/native/WebView2Loader.dll": {
            "assetType": "native",
            "rid": "win-x64"
          },
          "runtimes/win-x86/native/WebView2Loader.dll": {
            "assetType": "native",
            "rid": "win-x86"
          }
        }
      },
      "Newtonsoft.Json/13.0.3": {
        "type": "package",
        "compile": {
          "lib/net6.0/Newtonsoft.Json.dll": {
            "related": ".xml"
          }
        },
        "runtime": {
          "lib/net6.0/Newtonsoft.Json.dll": {
            "related": ".xml"
          }
        }
      }
    }
  },
  "libraries": {
    "Microsoft.Web.WebView2/1.0.2739.15": {
      "sha512": "hZg7vHWBg4RIiK3rhkNqX3hcBqqoVXVrrO2BVrVOiSmEgfLa7lY64G1tWh2VY84MfHIFLCAQNwn3Rwvu+ICHyw==",
      "type": "package",
      "path": "microsoft.web.webview2/1.0.2739.15",
      "hasTools": true,
      "files": [
        ".nupkg.metadata",
        ".signature.p7s",
        "LICENSE.txt",
        "NOTICE.txt",
        "WebView2.idl",
        "WebView2.tlb",
        "build/Common.targets",
        "build/Microsoft.Web.WebView2.targets",
        "build/WebView2Rules.Project.xml",
        "build/native/Microsoft.Web.WebView2.targets",
        "build/native/arm64/WebView2Loader.dll",
        "build/native/arm64/WebView2Loader.dll.lib",
        "build/native/arm64/WebView2LoaderStatic.lib",
        "build/native/include-winrt/WebView2Interop.h",
        "build/native/include-winrt/WebView2Interop.idl",
        "build/native/include-winrt/WebView2Interop.tlb",
        "build/native/include/WebView2.h",
        "build/native/include/WebView2EnvironmentOptions.h",
        "build/native/x64/WebView2Loader.dll",
        "build/native/x64/WebView2Loader.dll.lib",
        "build/native/x64/WebView2LoaderStatic.lib",
        "build/native/x86/WebView2Loader.dll",
        "build/native/x86/WebView2Loader.dll.lib",
        "build/native/x86/WebView2LoaderStatic.lib",
        "build/wv2winrt.targets",
        "lib/Microsoft.Web.WebView2.Core.winmd",
        "lib/net462/Microsoft.Web.WebView2.Core.dll",
        "lib/net462/Microsoft.Web.WebView2.Core.xml",
        "lib/net462/Microsoft.Web.WebView2.WinForms.dll",
        "lib/net462/Microsoft.Web.WebView2.WinForms.xml",
        "lib/net462/Microsoft.Web.WebView2.Wpf.dll",
        "lib/net462/Microsoft.Web.WebView2.Wpf.xml",
        "lib_manual/net6.0-windows10.0.17763.0/Microsoft.Web.WebView2.Core.Projection.dll",
        "lib_manual/netcoreapp3.0/Microsoft.Web.WebView2.Core.dll",
        "lib_manual/netcoreapp3.0/Microsoft.Web.WebView2.Core.xml",
        "lib_manual/netcoreapp3.0/Microsoft.Web.WebView2.WinForms.dll",
        "lib_manual/netcoreapp3.0/Microsoft.Web.WebView2.WinForms.xml",
        "lib_manual/netcoreapp3.0/Microsoft.Web.WebView2.Wpf.dll",
        "lib_manual/netcoreapp3.0/Microsoft.Web.WebView2.Wpf.xml",
        "microsoft.web.webview2.1.0.2739.15.nupkg.sha512",
        "microsoft.web.webview2.nuspec",
        "runtimes/win-arm64/native/WebView2Loader.dll",
        "runtimes/win-arm64/native_uap/Microsoft.Web.WebView2.Core.dll",
        "runtimes/win-x64/native/WebView2Loader.dll",
        "runtimes/win-x64/native_uap/Microsoft.Web.WebView2.Core.dll",
        "runtimes/win-x86/native/WebView2Loader.dll",
        "runtimes/win-x86/native_uap/Microsoft.Web.WebView2.Core.dll",
        "tools/VisualStudioToolsManifest.xml",
        "tools/wv2winrt/Antlr3.Runtime.dll",
        "tools/wv2winrt/Antlr4.StringTemplate.dll",
        "tools/wv2winrt/System.Buffers.dll",
        "tools/wv2winrt/System.CommandLine.DragonFruit.dll",
        "tools/wv2winrt/System.CommandLine.Rendering.dll",
        "tools/wv2winrt/System.CommandLine.dll",
        "tools/wv2winrt/System.Memory.dll",
        "tools/wv2winrt/System.Numerics.Vectors.dll",
        "tools/wv2winrt/System.Runtime.CompilerServices.Unsafe.dll",
        "tools/wv2winrt/codegen_util.dll",
        "tools/wv2winrt/concrt140_app.dll",
        "tools/wv2winrt/cs/System.CommandLine.resources.dll",
        "tools/wv2winrt/de/System.CommandLine.resources.dll",
        "tools/wv2winrt/es/System.CommandLine.resources.dll",
        "tools/wv2winrt/fr/System.CommandLine.resources.dll",
        "tools/wv2winrt/it/System.CommandLine.resources.dll",
        "tools/wv2winrt/ja/System.CommandLine.resources.dll",
        "tools/wv2winrt/ko/System.CommandLine.resources.dll",
        "tools/wv2winrt/msvcp140_1_app.dll",
        "tools/wv2winrt/msvcp140_2_app.dll",
        "tools/wv2winrt/msvcp140_app.dll",
        "tools/wv2winrt/pl/System.CommandLine.resources.dll",
        "tools/wv2winrt/pt-BR/System.CommandLine.resources.dll",
        "tools/wv2winrt/ru/System.CommandLine.resources.dll",
        "tools/wv2winrt/tr/System.CommandLine.resources.dll",
        "tools/wv2winrt/type_hierarchy.dll",
        "tools/wv2winrt/vcamp140_app.dll",
        "tools/wv2winrt/vccorlib140_app.dll",
        "tools/wv2winrt/vcomp140_app.dll",
        "tools/wv2winrt/vcruntime140_app.dll",
        "tools/wv2winrt/winrt_winmd.dll",
        "tools/wv2winrt/winrt_winmd.winmd",
        "tools/wv2winrt/wv2winrt.exe",
        "tools/wv2winrt/wv2winrt.exe.config",
        "tools/wv2winrt/wv2winrt.xml",
        "tools/wv2winrt/zh-Hans/System.CommandLine.resources.dll",
        "tools/wv2winrt/zh-Hant/System.CommandLine.resources.dll"
      ]
    },
    "Newtonsoft.Json/13.0.3": {
      "sha512": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==",
      "type": "package",
      "path": "newtonsoft.json/13.0.3",
      "files": [
        ".nupkg.metadata",
        ".signature.p7s",
        "LICENSE.md",
        "README.md",
        "lib/net20/Newtonsoft.Json.dll",
        "lib/net20/Newtonsoft.Json.xml",
        "lib/net35/Newtonsoft.Json.dll",
        "lib/net35/Newtonsoft.Json.xml",
        "lib/net40/Newtonsoft.Json.dll",
        "lib/net40/Newtonsoft.Json.xml",
        "lib/net45/Newtonsoft.Json.dll",
        "lib/net45/Newtonsoft.Json.xml",
        "lib/net6.0/Newtonsoft.Json.dll",
        "lib/net6.0/Newtonsoft.Json.xml",
        "lib/netstandard1.0/Newtonsoft.Json.dll",
        "lib/netstandard1.0/Newtonsoft.Json.xml",
        "lib/netstandard1.3/Newtonsoft.Json.dll",
        "lib/netstandard1.3/Newtonsoft.Json.xml",
        "lib/netstandard2.0/Newtonsoft.Json.dll",
        "lib/netstandard2.0/Newtonsoft.Json.xml",
        "newtonsoft.json.13.0.3.nupkg.sha512",
        "newtonsoft.json.nuspec",
        "packageIcon.png"
      ]
    }
  },
  "projectFileDependencyGroups": {
    "net8.0-windows7.0": [
      "Microsoft.Web.WebView2 >= 1.0.2739.15",
      "Newtonsoft.Json >= 13.0.3"
    ]
  },
  "packageFolders": {
    "C:\\Users\\Sefinek\\.nuget\\packages\\": {},
    "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
  },
  "project": {
    "version": "1.0.3",
    "restore": {
      "projectUniqueName": "D:\\Projects\\apps\\Sefinek-Blocklists-App\\SefinekBlocklists\\Sefinek Blocklists App.csproj",
      "projectName": "Sefinek Blocklists",
      "projectPath": "D:\\Projects\\apps\\Sefinek-Blocklists-App\\SefinekBlocklists\\Sefinek Blocklists App.csproj",
      "packagesPath": "C:\\Users\\Sefinek\\.nuget\\packages\\",
      "outputPath": "D:\\Projects\\apps\\Sefinek-Blocklists-App\\SefinekBlocklists\\obj\\",
      "projectStyle": "PackageReference",
      "fallbackFolders": [
        "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
      ],
      "configFilePaths": [
        "C:\\Users\\Sefinek\\AppData\\Roaming\\NuGet\\NuGet.Config",
        "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
        "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
      ],
      "originalTargetFrameworks": [
        "net8.0-windows"
      ],
      "sources": {
        "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
        "https://api.nuget.org/v3/index.json": {}
      },
      "frameworks": {
        "net8.0-windows7.0": {
          "targetAlias": "net8.0-windows",
          "projectReferences": {}
        }
      },
      "warningProperties": {
        "warnAsError": [
          "NU1605"
        ]
      },
      "restoreAuditProperties": {
        "enableAudit": "true",
        "auditLevel": "low",
        "auditMode": "direct"
      }
    },
    "frameworks": {
      "net8.0-windows7.0": {
        "targetAlias": "net8.0-windows",
        "dependencies": {
          "Microsoft.Web.WebView2": {
            "target": "Package",
            "version": "[1.0.2739.15, )"
          },
          "Newtonsoft.Json": {
            "target": "Package",
            "version": "[13.0.3, )"
          }
        },
        "imports": [
          "net461",
          "net462",
          "net47",
          "net471",
          "net472",
          "net48",
          "net481"
        ],
        "assetTargetFallback": true,
        "warn": true,
        "frameworkReferences": {
          "Microsoft.NETCore.App": {
            "privateAssets": "all"
          },
          "Microsoft.WindowsDesktop.App.WindowsForms": {
            "privateAssets": "none"
          }
        },
        "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.403/PortableRuntimeIdentifierGraph.json"
      }
    }
  }
}

I am using only Microsoft.Web.WebView2 and Newtonsoft.Json in my project.

I’ve identified that the issue is caused by Microsoft.Web.WebView2 starting from version >1.0.2792.45. Currently, I am using an older version.

Old version

Image With version 1.0.2739.15, there are no issues whatsoever.

Latest

Image With the Windows App Packaging project, another error appears.

Still has this issue in .net 8.0.402 sdk.

Any progress should we know?

@dedale Unfortunately just adding that to my csproj breaks the project:

Build Errors

To circumvent this error, you may try to look at project.assets.json to help identify if some dependency is bringing in old Windows base version and then update this dependency accordingly. HTH

Maybe dotnet/sdk would be a better fit for this. There are some issues that sound related, for instance WindowsBase NETCoreApp vs WindowsDesktopApp Do not autoreference WindowsBase.dll in Microsoft.NetCore.App