Windows SDK compiler error in MAUI app: WMC0621 Cannot resolve 'GenXbf.dll' under path

72 views Asked by At

I've always had success building this project of mine that is based on MAUI, however today it started failing with this error when trying to compile it in Visual Studio for Windows:

Error WMC0621 Cannot resolve 'GenXbf.dll' under path 'C:\Users\knocte\Documents\Code\RIM\packages\microsoft.windowsappsdk\1.2.221209.1\buildTransitive..\tools\net472..\x64\genxbf.dll'. Please ensure that the Nuget was properly restored and that the path is available on disk. Frontend C:\Users\knocte\Documents\Code\RIM\packages\microsoft.windowsappsdk\1.2.221209.1\tools\x64\genxbf.dll 1

My project file has this fragment which seems very related to this:


        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041</TargetFrameworks>
...
        <SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</SupportedOSPlatformVersion>
        <TargetPlatformMinVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</TargetPlatformMinVersion>
    </PropertyGroup>
    <ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
        <!-- Required? - WinUI does not yet have buildTransitive for everything -->
        <PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.5.1" />
        <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.221209.1" />
    </ItemGroup>
1

There are 1 answers

0
knocte On

This bug seems like a regression of this github issue.

As it is mentioned there that upgrading should do the trick (although they bring up version numbers that are older than what I had), then I changed my .csproj this way:

diff --git a/src/Frontend/Frontend.csproj b/src/Frontend/Frontend.csproj
index 0ace6b0..2144300 100644
--- a/src/Frontend/Frontend.csproj
+++ b/src/Frontend/Frontend.csproj
@@ -23,8 +23,8 @@
        <SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net7.0-ios'">14.2</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net7.0-maccatalyst'">14.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net7.0-android'">23.0</SupportedOSPlatformVersion>
-       <SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</SupportedOSPlatformVersion>
-       <TargetPlatformMinVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.17763.0</TargetPlatformMinVersion>
+       <SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.19041.0</SupportedOSPlatformVersion>
+       <TargetPlatformMinVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.19041.0</TargetPlatformMinVersion>
    </PropertyGroup>
 
    <ItemGroup>
@@ -38,7 +38,7 @@
    <ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
        <!-- Required? - WinUI does not yet have buildTransitive for everything -->
        <PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.5.1" />
-       <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.221209.1" />
+       <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.3.230602002" />
    </ItemGroup>

And it surprisingly did the trick.

BTW the beginning of the .csproj file had this:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041</TargetFrameworks>