Avalonia icon indicating copy to clipboard operation
Avalonia copied to clipboard

Upgrading to 11.1 breaks ClickOnce deployment

Open giard-alexandre opened this issue 6 months ago • 2 comments

Describe the bug

Running locally works fine using either my IDE or dotnet run. When packing the application using a variation of the following command:

msbuild MyApp.sln -t:restore,publish -p:Configuration=Release -p:PublishProfile="${{env.PUBLISH_PROFILE}}" -p:PublishDir="${{env.PUBLISH_PATH}}" -p:ApplicationRevision=${{github.run_number}} -p:PublishUrl="${{env.DEPLOY_DEST}}" -p:InstallUrl="${{env.DEPLOY_DEST}}"

It builds and publishes properly but, when trying to run the actual artifact produced by this, I get the following error:

Avalonia.Markup.Xaml.XamlLoadException: No precompiled XAML found for MyApp.App.App, make sure to specify x:Class and include your XAML file as AvaloniaResource
   at void Avalonia.Markup.Xaml.AvaloniaXamlLoader.Load(object obj)
   at void Tesseract.App.App.Initialize()
   at void Avalonia.AppBuilder.SetupUnsafe()
   at void Avalonia.AppBuilder.Setup()
   at AppBuilder Avalonia.AppBuilder.SetupWithLifetime(IApplicationLifetime lifetime)
   at int Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, string[] args, Action<IClassicDesktopStyleApplicationLifetime> lifetimeBuilder)
   at int MyApp.App.Program.Main(string[] args)

In this case, my Program.cs builds the Avalonia app this way:

public static AppBuilder BuildAvaloniaApp() {
  AppBuilder.Configure<App>().UsePlatformDetect().LogToTrace().UseReactiveUI();
}

Where App is class in the MyApp.App project.

My only possible thought here is the ClickOnce is weird and not properly packing the app, but this doesn't explain why it worked fine with Avalonia 11 and 10.

To Reproduce

Try to deploy an app using ClickOnce and msbuild?

Expected behavior

The output app should run as it did for v11.0

Avalonia version

11.1.3

OS

Windows

Additional context

Unfortunately this is a Company app so I'm limited in the source code I can share. Hopefully the conditions causing the bug rings a bell to anyone more intimate with the changes from 11.0 => 11.1!

I should also mention that my csproj for this project look a LOT like the default csproj from the 11.1 template, and so should run fine.

giard-alexandre avatar Aug 19 '24 20:08 giard-alexandre