Skip to content

Unable to create a runnable msixbundle #4577

Open
@boergegrunicke

Description

@boergegrunicke

Describe the bug

Creating a new project with from template in Visual Studio and publishing them to msixbundle only produces crashing output but nothing working

Steps to reproduce the bug

  1. Open Visual Studio and create a new project
  2. Select blank app with windows application packaging project (WinUI 3 in Desktop)
  3. Give it a name and create it (target and minimum version seem not really to matter)
  4. Run it (it will run properly)
  5. Right-click the packaging project -> Publish -> Create App Packages ... -> Sideloading -> Select a vertificate -> Create!
  6. it will fail "The specified RuntimeIdentifier is not recognized" -> okay by removing all win10-xxx runtime identifiers and only keeping the win-xxx identifiers this will work.
  7. Jump to the output folder and install the msixbundle.
  8. Try to launch the app from the start menu -> Nothing will happen
  9. Check the system event log. There is an error containing a hint to C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.5_5001.178.1908.0_x64__8wekyb3d8bbwe\Microsoft.ui.xaml.dll#
  10. By setting PublishTrimmed to false and PublishReadyToRun to True in the publish profile as well as WindowsAppSDKSelfContained to True in the csproj and wapproj this can be solved
  11. Publish again and install it: Now it will crash again:
Application: App.exe
CoreCLR Version: 8.0.724.31311
.NET Version: 8.0.7
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException: The type initializer for '<Module>' threw an exception.
 ---> System.MissingMethodException: Method not found: 'Void System.Environment.SetEnvironmentVariable(System.String, System.String)'.
   at Microsoft.Windows.Foundation.UndockedRegFreeWinRTCS.AutoInitialize.AccessWindowsAppSDK()
   --- End of inner exception stack trace ---

Expected behavior

Creating an app package should produce something that contains all necessary references will start without a crash, or there should be at least a guide somewhere how to get it running

Screenshots

No response

NuGet package version

Windows App SDK 1.5.5: 1.5.240627000

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

No response

Metadata

Metadata

Assignees

Labels

area-DeploymentIssues related to packaging, installation, runtime (e.g., SelfContained, Unpackaged)area-DeveloperToolsIssues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integrationneeds-assignee-attention

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions