wpf: Could not find assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

  • .NET Core Version: (e.g. 3.0 Preview1, or daily build number, use dotnet --info)
  • Windows version: (17763.379)
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: I haven’t tried

Problem description: Using the latest core-sdk version, the WPF app from the https://github.com/ridomin/msix-catalog repo no longer builds.

Actual behavior: Microsoft.WinFX.targets(243,9): error MC1000: Unknown build error, 'Could not find assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly.' [D:\GIT\msix-catalog-master\msix.catalog.app\msix.catalog.app.core.csproj]

Expected behavior: Compilation should work.

Minimal repro:

  1. Download https://github.com/ridomin/msix-catalog
  2. cd msix-catalog-master\msix.catalog.app
  3. dotnet publish -r win-x64 msix.catalog.app.core.csproj

NOTE: I’m observing that we’re now setting _PresentationBuildTaskTfm to netcoreapp2.1 in Microsoft.WinFX.targets: <_PresentationBuildTasksTfm Condition="'$(MSBuildRuntimeType)' == 'Core'">netcoreapp2.1</_PresentationBuildTasksTfm> It used to be netcoreapp3.0. Is this intentional?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@vatsan-madhavan provided a more comprehensive fix that I am still testing locally. Thanks.

The propsed fix is good. Everything builds cleanly when all reference assemblies are built against a new System.Xaml that contains the desktop public key token. I’m currently working with @vatsan-madhavan to set StrongNameKeyId to ECMA for all shipping WPF assemblies. Thank you @fadimounir for reporting the issue and @nguerrera for root-causing.