microsoft / microsoft-ui-xaml

WinUI: a modern UI framework with a rich set of controls and styles to build dynamic and high-performing Windows applications.
MIT License
6.39k stars 683 forks source link

Can not find the .xbf file #10039

Closed Miaoyww closed 1 month ago

Miaoyww commented 2 months ago

Describe the bug

before:

image

        <OutputType>WinExe</OutputType>
        <TargetFramework>net9.0-windows10.0.22621.0</TargetFramework>
        <WindowsSdkPackageVersion>10.0.22621.41</WindowsSdkPackageVersion>
        <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>

after

image

        <OutputType>WinExe</OutputType>
        <TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
        <WindowsSdkPackageVersion>10.0.26100.48</WindowsSdkPackageVersion>
        <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>

Steps to reproduce the bug

I just upgraded my app from .net 8 to 9 and it could not compile any longer.

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

Miaoyww commented 2 months ago

whole csproj

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>WinExe</OutputType>
        <TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
        <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
        <WindowsSdkPackageVersion>10.0.26100.48</WindowsSdkPackageVersion>\
        <Platforms>x86;x64;ARM64</Platforms>
        <RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
        <PublishProfile>win10-$(Platform).pubxml</PublishProfile>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
        <EnableMsixTooling>true</EnableMsixTooling>
        <!-- Assembly Info Properties -->
        <RootNamespace>NonsPlayer</RootNamespace>
        <AssemblyName>NonsPlayer</AssemblyName>
        <ProductName>NonsPlayer</ProductName>
        <Product>NonsPlayer</Product>
        <Description>NonsPlayer</Description>
        <AssemblyTitle>NonsPlayer</AssemblyTitle>
        <!-- WinUI Properties -->
        <UseRidGraph>true</UseRidGraph>
        <UseWinUI>true</UseWinUI>
        <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
        <WindowsPackageType>None</WindowsPackageType>
        <AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
        <ApplicationIcon>Assets/WindowIcon.ico</ApplicationIcon>
        <Configurations>Debug;Release</Configurations>
        <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
        <IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
        <JsonSerializerIsReflectionEnabledByDefault>true</JsonSerializerIsReflectionEnabledByDefault>
        <PublishReadyToRun>true</PublishReadyToRun>
        <ApplicationManifest>app.manifest</ApplicationManifest>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
        <PackageReference Include="CommunityToolkit.WinUI.Controls.MetadataControl" Version="8.1.240916" />
        <PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.1.240916" />
        <PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.1.240916" />
        <PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.1.240916" />
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="WinUIEx" Version="2.4.2" />
        <PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0-rc.1.24431.7" />
        <PackageReference Include="Microsoft.Windows.CsWin32" PrivateAssets="all" Version="0.3.106">
            <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
        </PackageReference>
        <PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240923002" />
        <PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="Serilog" Version="4.1.0-dev-02238" />
        <PackageReference Include="Serilog.Extensions.Logging" Version="8.0.1-dev-10398" />
        <PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
        <PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
    </ItemGroup>

    <ItemGroup>
        <PackageReference Include="Dapper" Version="2.1.35" />
        <PackageReference Include="F23.StringSimilarity" Version="6.0.0" />
        <PackageReference Include="ksemenenko.ColorThief" Version="1.1.1.4" />
        <PackageReference Include="MouseKeyHook" Version="5.7.1" />
        <PackageReference Include="NAudio" Version="2.2.1" />
        <PackageReference Include="NuGet.Versioning" Version="6.11.1" />
        <PackageReference Include="QRCoder" Version="1.6.0" />
        <PackageReference Include="RestSharp" Version="112.1.0" />
        <PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
        <PackageReference Include="z440.atl.core" Version="6.5.0" />
        <Manifest Include="$(ApplicationManifest)" />
    </ItemGroup>

    <ItemGroup>
        <ProjectReference Include="..\NonsPlayer.Core\NonsPlayer.Core.csproj" />
        <ProjectReference Include="..\NonsPlayer.Updater\NonsPlayer.Updater.csproj" />
    </ItemGroup>

    <ItemGroup>
        <Content Include="Assets\**">
            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
        </Content>
    </ItemGroup>

    <ItemGroup>
        <Content Update="Assets\Fonts\HARMONYOS_SANS_SC_BLACK.TTF">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
        <Content Update="Assets\Fonts\HARMONYOS_SANS_SC_BOLD.TTF">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
        <Content Update="Assets\Fonts\HARMONYOS_SANS_SC_LIGHT.TTF">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
        <Content Update="Assets\Fonts\HARMONYOS_SANS_SC_MEDIUM.TTF">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
        <Content Update="Assets\Fonts\HARMONYOS_SANS_SC_REGULAR.TTF">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
        <Content Update="Assets\Fonts\HARMONYOS_SANS_SC_THIN.TTF">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
        <Content Update="Assets\Fonts\NOVECENTO-WIDE-BOLD.OTF">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
        <Content Update="Assets\Fonts\Segoe Fluent Icons.ttf">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </Content>
    </ItemGroup>
</Project>
kmgallahan commented 1 month ago

.NET 9 hasn't had its final release yet and isn't supported out of the box. I imagine if you want to get this to work before release you'd have to do something along of the lines of what is required in the UWP .NET 9 support writeup:

https://devblogs.microsoft.com/ifdef-windows/preview-uwp-support-for-dotnet-9-native-aot/

You’ll also need an updated version of the XAML compiler that supports .NET 9 projects. This will be included in an upcoming servicing release of the Windows 11 SDK (10.0.26100.0). However, if you want to try things out today, we have a small bundle with just the updated XAML compiler, which you can manually patch on your machine.

Miaoyww commented 1 month ago

Well, after i added <PackageReference Include="Microsoft.Windows.SDK.Win32Metadata" Version="62.0.23-preview" /> and updated xaml compiler with preview-uwp-support-for-dotnet9-windows-sdk, it indeed did not report xaml errors any more.However, it still told me that it couldn't find .xbf file.

    <ItemGroup>
        <PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
        <PackageReference Include="CommunityToolkit.WinUI.Controls.MetadataControl" Version="8.1.240916" />
        <PackageReference Include="CommunityToolkit.WinUI.Controls.Primitives" Version="8.1.240916" />
        <PackageReference Include="CommunityToolkit.WinUI.Controls.SettingsControls" Version="8.1.240916" />
        <PackageReference Include="CommunityToolkit.WinUI.Media" Version="8.1.240916" />
        <PackageReference Include="Microsoft.Windows.SDK.Win32Metadata" Version="62.0.23-preview" />
    </ItemGroup>

image