Skip to content
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

[NativeAOT] Publishing a universal project doesn't produce a universal pkg #19391

Closed
rolfbjarne opened this issue Nov 6, 2023 · 5 comments · Fixed by #21412
Closed

[NativeAOT] Publishing a universal project doesn't produce a universal pkg #19391

rolfbjarne opened this issue Nov 6, 2023 · 5 comments · Fixed by #21412
Labels
bug If an issue is a bug or a pull request a bug fix
Milestone

Comments

@rolfbjarne
Copy link
Member

Repro: dotnet publish a macOS project with RuntimeIdentifiers=osx-arm64;osx-x64

The resulting package is here:

./bin/Release/net8.0-macos/osx-arm64/publish/MySimpleApp.pkg

instead of here:

./bin/Release/net8.0-macos/publish/MySimpleApp-3.14.pkg

msbuild.binlog.zip

Seems like this fixes the problem:

<PropertyGroup>
    <UseCurrentRuntimeIdentifier>false</UseCurrentRuntimeIdentifier>
</PropertyGroup>
@rolfbjarne rolfbjarne added the bug If an issue is a bug or a pull request a bug fix label Nov 6, 2023
@rolfbjarne rolfbjarne modified the milestones: Future, .NET 9 Nov 6, 2023
@rolfbjarne rolfbjarne modified the milestones: .NET 9, .NET 10 Sep 27, 2024
@rolfbjarne
Copy link
Member Author

This was fixed here: 5633f4e

@tipa
Copy link

tipa commented Oct 10, 2024

Is this fixed in .NET RC2? I still don't get universal packages if I don't set the UseCurrentRuntimeIdentifier property.

@rolfbjarne
Copy link
Member Author

@tipa the fix is in RC 2. Can you get a binlog?

@rolfbjarne
Copy link
Member Author

Ah, I think I see what's happening, we correctly set UseCurrentRuntimeIdentifier=false if the project file sets RuntimeIdentifiers, but not if the default RuntimeIdentifiers is used, because it's set a few lines further down the file:

Setting UseCurrentRuntimeIdentifier=false on line 99:

<UseCurrentRuntimeIdentifier Condition="'$(_UseNativeAot)' == 'true' And '$(RuntimeIdentifiers)' != '' And '$(RuntimeIdentifier)' == ''">false</UseCurrentRuntimeIdentifier>

Setting RuntimeIdentifiers=false on line 133:

<RuntimeIdentifiers Condition="'$(RuntimeIdentifier)' == '' And '$(Configuration)' == 'Release' And '$(_PlatformName)' == 'macOS'">osx-x64;osx-arm64</RuntimeIdentifiers>

@rolfbjarne rolfbjarne reopened this Oct 10, 2024
@rolfbjarne rolfbjarne modified the milestones: .NET 10, .NET 9 Oct 10, 2024
rolfbjarne added a commit that referenced this issue Oct 10, 2024
… RuntimeIdentifiers value is set. Fixes #19391.

We need to set "UseCurrentRuntimeIdentifier=false", we must only set it for
the outer build for universal builds - when `RuntimeIdentifiers` is set - but
that means we can only do it *after* we set any default value for
`RuntimeIdentifiers`.

Fixes #19391 (comment).
@rolfbjarne
Copy link
Member Author

Fix is in progress.

azure-pipelines bot pushed a commit that referenced this issue Oct 11, 2024
… RuntimeIdentifiers value is set. Fixes #19391.

We need to set "UseCurrentRuntimeIdentifier=false", we must only set it for
the outer build for universal builds - when `RuntimeIdentifiers` is set - but
that means we can only do it *after* we set any default value for
`RuntimeIdentifiers`.

Fixes #19391 (comment).
rolfbjarne added a commit that referenced this issue Oct 11, 2024
…e default RuntimeIdentifiers value is set. Fixes #19391. (#21420)

We need to set "UseCurrentRuntimeIdentifier=false", we must only set it for
the outer build for universal builds - when `RuntimeIdentifiers` is set - but
that means we can only do it *after* we set any default value for `RuntimeIdentifiers`.

Fixes #19391 (comment).

Backport of #21412

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
haritha-mohan pushed a commit that referenced this issue Oct 19, 2024
… RuntimeIdentifiers value is set. Fixes #19391. (#21412)

We need to set "UseCurrentRuntimeIdentifier=false", we must only set it for
the outer build for universal builds - when `RuntimeIdentifiers` is set - but
that means we can only do it *after* we set any default value for
`RuntimeIdentifiers`.

Fixes #19391 (comment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug If an issue is a bug or a pull request a bug fix
Projects
Status: Done
2 participants