-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix --no-build publishing when axaml compiler is used #16835
Conversation
You can test this PR using the following package version. |
|
@cla-avalonia agree |
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Backport AvaloniaUI/Avalonia#16835 to versions 11.1.0 through 11.2.0-beta1
Backport AvaloniaUI/Avalonia#16835 to versions 11.1.0 through 11.2.0-beta1 Co-authored-by: Nick Cao <nickcao@nichi.co>
How do I implement this fix? I am having the same issue |
Here's how we backported the fix in nixpkgs: https://github.com/NixOS/nixpkgs/blob/ae8a436bc79e20e05d16f4df99aae01527602f0f/pkgs/build-support/dotnet/fetch-nupkg/overrides.nix#L45-L47 If you're getting Avalonia from nuGet, you can do something similar by substituting or patching replacing |
I made the changes as suggested for nuGet, however after publishing the application I still run into the same exception: |
I'm not too familiar with how this works outside of nixpkgs. It sounds like the Avalonia you're patching isn't the one being used after your app is published. Maybe something like "self contained build" will help? |
I added the following but still getting the same error? Also I am on Avalonia version 11.1.3.
|
You can get the fix by updating to 11.2.0-beta2 |
What does the pull request do?
Fixes
dotnet publish --no-build
when axaml compiler is used.What is the current behavior?
The original assembly before axaml compilation is copied resulting in the following crash:
Unhandled exception. Avalonia.Markup.Xaml.XamlLoadException: No precompiled XAML found for AvaloniaApplication1.App, make sure to specify x:Class and include your XAML file as AvaloniaResource
What is the updated/expected behavior with this PR?
The proper assembly is copied over, and the application starts correctly.
How was the solution implemented (if it's not obvious)?
I've used
ComputeResolvedFilesToPublishList
because that's whereIntermediateAssembly
and_DebugSymbolsIntermediatePath
are processed.An alternative solution is prependingTurns out even that won't work becauseInjectAvaloniaXamlOutput
toPublishItemsOutputGroupDependsOn
ComputeAndCopyFilesToPublishDirectory
would end up callingComputeResolvedFilesToPublishList
beforePublishItemsOutputGroup
.Adding
PublishItemsOutputGroup
toInjectAvaloniaXamlOutput
'sBeforeTargets
won't work because it will run afterComputeResolvedFilesToPublishList
.Repro
rm -rf bin obj && dotnet build -c Release && dotnet publish --no-build && ./bin/Release/net8.0/publish/AvaloniaApplication1