Fix PublishDotnetAot target NETSDK1047 error in CI#54114
Open
NikolaMilosavljevic wants to merge 3 commits intodotnet:mainfrom
Open
Fix PublishDotnetAot target NETSDK1047 error in CI#54114NikolaMilosavljevic wants to merge 3 commits intodotnet:mainfrom
NikolaMilosavljevic wants to merge 3 commits intodotnet:mainfrom
Conversation
In CI, Arcade's centralized NuGet restore runs without RuntimeIdentifier, so the assets file lacks the RID-specific target. This caused NETSDK1047: 'Assets file doesn't have a target for net11.0/win-x64'. Fix by splitting Restore and Publish into separate MSBuild calls: - Restore with RuntimeIdentifiers (plural) to add RID target to assets - Publish with RuntimeIdentifier (singular) to use the complete assets Also re-enables the target (was disabled in PR dotnet#54067 as a workaround). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses CI failures (NETSDK1047) when building/publishing the dotnet-aot NativeAOT shared library as part of SDK layout generation, caused by Arcade’s centralized restore not producing RID-specific restore targets.
Changes:
- Re-enable
PublishDotnetAoton supported host-native builds (TargetRid == HostRidfor win/linux/osx). - Split the previous combined
Restore;PublishMSBuild invocation into two calls:RestoreusingRuntimeIdentifiers, thenPublishusingRuntimeIdentifier. - Add an explanatory comment documenting the CI/Arcade restore behavior that leads to NETSDK1047.
IntermediateOutputPath controls build output, but NuGet Restore uses BaseIntermediateOutputPath for project.assets.json location. Without this, Arcade's centralized restore writes to artifacts/obj/dotnet-aot/ while our Publish looks in artifacts/obj/dotnet-aot-redist/, causing NETSDK1047. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Apr 28, 2026
Open
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.
Summary
Fixes the NETSDK1047 build error introduced in #54056 that was worked around by disabling the target in #54067.
Root Cause
In CI, Arcade's centralized NuGet restore runs via
NuGet.targetswithoutRuntimeIdentifier, so theproject.assets.jsonlacks the RID-specific target. WhenTargets="Restore;Publish\"was called withRuntimeIdentifier=, it failed with:Fix
Split the single
Targets="Restore;Publish\"call into two separate MSBuild invocations:RuntimeIdentifiers(plural) - adds the RID target to the assets fileRuntimeIdentifier(singular) - uses the now-complete assets fileThis follows the established pattern from test/xunit-runner/XUnitRunner.targets:64-75 which handles the same CI/Arcade restore conflict.
Changes
TargetRid == HostRidon supported platforms)RuntimeIdentifiers(plural) for Restore vsRuntimeIdentifier(singular) for Publish