Repository navigation
Run GenerateAvaloniaResources before _InjectAvaloniaAdditionalFiles - #22175
Merged
MrJul merged 1 commit intoSep 11, 2026
Merged
Conversation
GenerateAvaloniaResources adds AvaloniaXaml items to AvaloniaResource, which _InjectAvaloniaAdditionalFiles then reads to build AvaloniaResourcePaths. Nothing ordered the two, so the property could be built from a partial list depending on which target MSBuild scheduled first.
|
You can test this PR using the following package version. |
MrJul
approved these changes
Sep 11, 2026
MrJul
left a comment
Member
There was a problem hiding this comment.
The change makes sense. In a normal (non-design) build, GenerateAvaloniaResources has already run so this doesn't affect the standard path.
LGTM!
MrJul
pushed a commit
to MrJul/Avalonia
that referenced
this pull request
Sep 22, 2026
…valoniaUI#22175) GenerateAvaloniaResources adds AvaloniaXaml items to AvaloniaResource, which _InjectAvaloniaAdditionalFiles then reads to build AvaloniaResourcePaths. Nothing ordered the two, so the property could be built from a partial list depending on which target MSBuild scheduled first.
grokys
pushed a commit
to Evan260/Avalonia
that referenced
this pull request
Oct 7, 2026
…valoniaUI#22175) GenerateAvaloniaResources adds AvaloniaXaml items to AvaloniaResource, which _InjectAvaloniaAdditionalFiles then reads to build AvaloniaResourcePaths. Nothing ordered the two, so the property could be built from a partial list depending on which target MSBuild scheduled first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
Makes
_InjectAvaloniaAdditionalFilesdepend onGenerateAvaloniaResources, soAvaloniaResourcePathsis always complete.What is the current behavior?
GenerateAvaloniaResourcesaddsAvaloniaXamlitems toAvaloniaResource._InjectAvaloniaAdditionalFilesreadsAvaloniaResourceto buildAvaloniaResourcePaths. Nothing orders the two, so the result depends on which target MSBuild happens to schedule first.Using
samples/AppWithoutLifetimeon main:The three
.axamlfiles are missing in the second case, so source generators using the property see an incomplete list.Only affects projects whose XAML comes through
AvaloniaXaml, which is the default for.axaml. Projects that put files straight intoAvaloniaResourcewere never affected, which is why most samples in this repo don't show it.What is the updated/expected behavior with this PR?
Both commands return the full list.
How was the solution implemented (if it's not obvious)?
Added
DependsOnTargets="GenerateAvaloniaResources", as suggested in the issue.GenerateAvaloniaResourcesdepends onAddAvaloniaResources;ResolveReferences;_GenerateAvaloniaResourcesDependencyCache, so there's no cycle.On the side effects @timunie asked about
GenerateAvaloniaResourcesnow runs whenever_InjectAvaloniaAdditionalFilesdoes, including design-time builds. As far as I can tell that's harmless:.axamland a.xamlsample build clean.dotnet build -t:GenerateMSBuildEditorConfigFile -p:DesignTimeBuild=truesucceeds.Skipping target "GenerateAvaloniaResources" because all output files are up-to-date. It isn't redoing work in the IDE.Checklist
No test, since this is target ordering and I couldn't find a harness for it. The two commands above are the check.
Breaking changes
None.
Fixed issues
Fixes #21945