0

I get this error message when I try to start my WinUI 3 apps from Visual Studio:

enter image description here

But I already installed the newest .net v8.0.8. I also tried to install the specified v8.0.0 version but it did not help either. The installed runtimes on my PC:

enter image description here

My apps are WindowsAppSDKSelfContained with the following settings in the .csproj file:

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
    <TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
    <ApplicationManifest>app.manifest</ApplicationManifest>
    <Platforms>x86;x64;ARM64</Platforms>
    <RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
    <PublishProfile>win-$(Platform).pubxml</PublishProfile>
    <UseRidGraph>true</UseRidGraph>
    <UseWinUI>true</UseWinUI>
    <EnableMsixTooling>true</EnableMsixTooling>

    <WindowsPackageType>None</WindowsPackageType>
    <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
</PropertyGroup>

But interestingly when I start the .exe from the output folder it runs perfectly without this issue for one winui3 app but the other app has the same issue even when started from the .exe file. Both have the same settings in the .csproj files.

8
  • Are you having this issue from the start? or during the development? How about if you create a plain non-packaged, self-contained WinUI 3 app? Commented Sep 27, 2024 at 0:32
  • Could you please tell us what version of the Microsoft.WindowsAppSDK you're using? Commented Sep 27, 2024 at 1:38
  • @AndrewKeepCoding This issue appeared like a week ago. When I create another non-packaged, self-contained WinUI 3 app with the same settings in the .csproj it works fine without this error. Commented Sep 27, 2024 at 11:13
  • @Jeaninez-MSFT I was using an older version (1.4.230913002) when this issue appeared so I tried to update it to 1.6.240829007 version but the issue still persist. It may also worth to mention that if I add the <SelfContained>true </SelfContained> tag in the .csproj then the issue is gone. But I do not plan to use this option because I want the users to install the runtime I do not want to deliver it. Commented Sep 27, 2024 at 11:23
  • Have you tried deleting the bin folder, obj folder and restart VS? Commented Sep 29, 2024 at 23:43

1 Answer 1

0

The root cause of the problem was probably a Windows App SDK versioning mismatch. Especially when developing unpackaged apps, the version of the Windows App SDK installed on the PC has to match exactly the version of the Windows App SDK NuGet package of the WinUI project, otherwise issues arise. After I updated to a newer version of that NuGet package the issue got resolved.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.