Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add non-portable RID to list of known runtime packs instead of overwriting#96858

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@jtschuster
Copy link
Member

@jtschusterjtschuster commentedJan 11, 2024
edited
Loading

In#75597, for source-build we replace all the RIDs with only thePackageRID in theKnownFrameworkReference forNetCurrent when we should have only added an additional RID.

This was causing issues in crossbuilds of vertical builds. The crossgen and ilc projects that run within the build require a runtime for the build machine's RID, but it wasn't found inKnownFrameworkReference and the build failed during restore.

Part of reenabling Crossgen and ILC in arm64 crossbuild verticalsdotnet/source-build#3698

am11 reacted with thumbs up emoji
@ghost
Copy link

Tagging subscribers to this area: @dotnet/area-infrastructure-libraries
See info inarea-owners.md if you want to be subscribed.

Issue Details

In#75597, we replace all the RIDs with only thePackageRID in theKnownFrameworkReference forNetCurrent when we should have only added an additional RID.

This was causing issues in crossbuilds of vertical builds. The crossgen and ilc projects that run within the build require a runtime for the build machine's RID, but it wasn't found inKnownFrameworkReference and the build failed during restore.

Part of reenabling Crossgen and ILC in arm64 crossbuild verticalsdotnet/source-build#3698

Author:jtschuster
Assignees:-
Labels:

area-Infrastructure-libraries

Milestone:-

Comment on lines 25 to 28
<KnownFrameworkReferenceUpdate="@(KnownFrameworkReference
->WithMetadataValue('Identity', 'Microsoft.NETCore.App')
->WithMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"
RuntimePackRuntimeIdentifiers="%(RuntimePackRuntimeIdentifiers);$(PackageRID)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Does that Update statement with multiple lines actually work? I never saw this before.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It looks like it might be working, but I just double checked and it looks like the filtering might not be working correctly even on a single line.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ah, it needs to be a condition, notWithMetadataValue

Copy link
Member

@ViktorHoferViktorHoferJan 11, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We shouldn't use and item batching condition here. Such are less performant. Prefer msbuild item functions when possible.

Also, this currently works before with the item functions.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

In my repro project the item functions don't seem to work and will add the RID to each KnownFrameworkReference regardless of TFM or Identity. I'll see if there's a different way to do it with msbuild items functions.

<Project>  <PropertyGroup>    <NetCoreAppCurrent>net8.0</NetCoreAppCurrent>    <PackageRid>linux-arm64</PackageRid>  </PropertyGroup>  <ItemGroup>    <KnownFrameworkReferenceInclude="Microsoft.NETCore.App"TargetFramework="net8.0"RuntimePackRuntimeIdentifiers="OriginalRids"      />    <KnownFrameworkReferenceInclude="Microsoft.NETCore.App.NativeAOT"TargetFramework="net8.0"RuntimePackRuntimeIdentifiers="OriginalRids"      />    <KnownFrameworkReferenceInclude="Microsoft.NETCore.App"TargetFramework="net7.0"RuntimePackRuntimeIdentifiers="OriginalRids2"      />    <KnownFrameworkReferenceInclude="Microsoft.NETCore.App.NativeAOT"TargetFramework="net7.0"RuntimePackRuntimeIdentifiers="OriginalRids2"      />    <KnownCrossgen2PackInclude='Microsoft.NETCore.App.Crossgen2'Crossgen2RuntimeIdentifiers="OriginalRids"TargetFramework="net8.0" />    <KnownCrossgen2PackInclude='Microsoft.NETCore.App.Crossgen3'Crossgen2RuntimeIdentifiers="OriginalRids"TargetFramework="net8.0" />    <KnownCrossgen2PackInclude='Microsoft.NETCore.App.Crossgen2'Crossgen2RuntimeIdentifiers="OriginalRids2"TargetFramework="net7.0" />    <KnownCrossgen2PackInclude='Microsoft.NETCore.App.Crossgen3'Crossgen2RuntimeIdentifiers="OriginalRids2"TargetFramework="net7.0" />  </ItemGroup>  <TargetName="MyModifyingTarget">    <ItemGroupCondition="'$(NoBatch)' != 'true'">      <KnownFrameworkReferenceUpdate="@(KnownFrameworkReference)"Condition="'%(Identity)' == 'Microsoft.NETCore.App' AND '%(TargetFramework)' == '$(NetCoreAppCurrent)'"RuntimePackRuntimeIdentifiers="%(RuntimePackRuntimeIdentifiers);$(PackageRID)" />      <KnownCrossgen2PackUpdate="@(KnownCrossgen2Pack)"Condition="'%(Identity)' == 'Microsoft.NETCore.App.Crossgen2' AND '%(TargetFramework)' == '$(NetCoreAppCurrent)'"Crossgen2RuntimeIdentifiers="%(Crossgen2RuntimeIdentifiers);$(PackageRID)"/>    </ItemGroup>    <ItemGroupCondition="'$(NoBatch)' == 'true'">      <KnownFrameworkReferenceUpdate="@(KnownFrameworkReference)->WithMetadataValue('Identity', 'Microsoft.NETCore.App')->WithMetadataValue('TargetFramework', '$(NetCoreAppCurrent)')"RuntimePackRuntimeIdentifiers="%(RuntimePackRuntimeIdentifiers);$(PackageRID)" />      <KnownCrossgen2PackUpdate="@(KnownCrossgen2Pack->WithMetadataValue('Identity', 'Microsoft.NETCore.App.Crossgen2')->WithMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"Crossgen2RuntimeIdentifiers="%(Crossgen2RuntimeIdentifiers);$(PackageRID)"/>    </ItemGroup>    <MessageImportance="High"Text="KnownFrameworkReference:%0a%09Name: %(KnownFrameworkReference.Identity)%0a%09TFM: %(KnownFrameworkReference.TargetFramework)%0a%09RIDs: %(KnownFrameworkReference.RuntimePackRuntimeIdentifiers)" />    <MessageImportance="High"Text="KnownCrossgen2Pack:%0a%09Name: %(KnownCrossgen2Pack.Identity)%0a%09TFM: %(KnownCrossgen2Pack.TargetFramework)%0a%09RIDs: %(KnownCrossgen2Pack.Crossgen2RuntimeIdentifiers)" />  </Target></Project>

With NoBatch=true

  KnownFrameworkReference:        Name: Microsoft.NETCore.App        TFM: net8.0        RIDs: OriginalRids;linux-arm64  KnownFrameworkReference:        Name: Microsoft.NETCore.App.NativeAOT        TFM: net8.0        RIDs: OriginalRids;linux-arm64  KnownFrameworkReference:        Name: Microsoft.NETCore.App        TFM: net7.0        RIDs: OriginalRids2;linux-arm64  KnownFrameworkReference:        Name: Microsoft.NETCore.App.NativeAOT        TFM: net7.0        RIDs: OriginalRids2;linux-arm64  KnownCrossgen2Pack:        Name: Microsoft.NETCore.App.Crossgen2        TFM: net8.0        RIDs: OriginalRids;linux-arm64  KnownCrossgen2Pack:        Name: Microsoft.NETCore.App.Crossgen3        TFM: net8.0        RIDs: OriginalRids;linux-arm64  KnownCrossgen2Pack:        Name: Microsoft.NETCore.App.Crossgen2        TFM: net7.0        RIDs: OriginalRids2;linux-arm64  KnownCrossgen2Pack:        Name: Microsoft.NETCore.App.Crossgen3        TFM: net7.0        RIDs: OriginalRids2;linux-arm64

With NoBatch=false

  KnownFrameworkReference:        Name: Microsoft.NETCore.App        TFM: net8.0        RIDs: OriginalRids;linux-arm64  KnownFrameworkReference:        Name: Microsoft.NETCore.App.NativeAOT        TFM: net8.0        RIDs: OriginalRids  KnownFrameworkReference:        Name: Microsoft.NETCore.App        TFM: net7.0        RIDs: OriginalRids2  KnownFrameworkReference:        Name: Microsoft.NETCore.App.NativeAOT        TFM: net7.0        RIDs: OriginalRids2  KnownCrossgen2Pack:        Name: Microsoft.NETCore.App.Crossgen2        TFM: net8.0        RIDs: OriginalRids;linux-arm64  KnownCrossgen2Pack:        Name: Microsoft.NETCore.App.Crossgen3        TFM: net8.0        RIDs: OriginalRids  KnownCrossgen2Pack:        Name: Microsoft.NETCore.App.Crossgen2        TFM: net7.0        RIDs: OriginalRids2  KnownCrossgen2Pack:        Name: Microsoft.NETCore.App.Crossgen3        TFM: net7.0        RIDs: OriginalRids2

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ah, that half fixed it, but it still looks like it matches on the name of each item only, so it will update all 'Microsoft.NETCore.App' items in the group, regardless of the TFM, sonet7.0 item will also have the new RID.

  KnownFrameworkReference:        Name: Microsoft.NETCore.App        TFM: net8.0        RIDs: OriginalRids;linux-arm64  KnownFrameworkReference:        Name: Microsoft.NETCore.App.NativeAOT        TFM: net8.0        RIDs: OriginalRids  KnownFrameworkReference:        Name: Microsoft.NETCore.App        TFM: net7.0        RIDs: OriginalRids;linux-arm64  KnownFrameworkReference:        Name: Microsoft.NETCore.App.NativeAOT        TFM: net7.0        RIDs: OriginalRids

We could batch only the items with the Identity 'Microsoft.NETCore.App' onTargetFramework == NetCurrent to reduce the overhead, or assume it won't be an issue if we haven't already hit an issue where a previous TFM has the additional RID.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think you are doing something wrong.<KnownFrameworkReference Update="@(KnownFrameworkReference->WithMetadataValue('Identity', 'Microsoft.NETCore.App')->WithMetadataValue('TargetFramework', '$(NetCoreAppCurrent)')) ... works for me.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Okay, I might be doing something wrong in the repro, I'll try running a source build and check the binlog to test the change.

Copy link
MemberAuthor

@jtschusterjtschusterJan 11, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

In the source build all the items in theKnownFrameworkReferences itemgroup with the nameMicrosoft.NETCore.App are adding thePackageRid to their metadata, no matter theTargetFramework metadata. In afewplaces we do something like this:

<KnownFrameworkReferenceUpdate="Microsoft.NETCore.App">        <RuntimePackRuntimeIdentifiersCondition="'%(TargetFramework)' == '$(NetCoreAppCurrent)'">%(RuntimePackRuntimeIdentifiers);$(PackageRID)</RuntimePackRuntimeIdentifiers></KnownFrameworkReference><KnownCrossgen2PackUpdate="Microsoft.NETCore.App.Crossgen2">        <Crossgen2RuntimeIdentifiersCondition="'%(TargetFramework)' == '$(NetCoreAppCurrent)'">%(Crossgen2RuntimeIdentifiers);$(PackageRID)</Crossgen2RuntimeIdentifiers></KnownCrossgen2Pack>

It uses some batching, but I can't find another way to only update the item with the latest TFM.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

OK I was able to reproduce this. This seems to be an msbuild issue. Fileddotnet/msbuild#9636

@jtschusterjtschuster merged commit5e24539 intodotnet:mainJan 12, 2024
tmds pushed a commit to tmds/runtime that referenced this pull requestJan 23, 2024
…iting in source-build (dotnet#96858)Indotnet#75597, for source-build we replace all the RIDs with only the `PackageRID` in the `KnownFrameworkReference` for `NetCurrent` when we should have only added an additional RID.This was causing issues in crossbuilds of vertical builds. The crossgen and ilc projects that run within the build require a runtime for the build machine's RID, but it wasn't found in `KnownFrameworkReference` and the build failed during restore.Part of reenabling Crossgen and ILC in arm64 crossbuild verticalsdotnet/source-build#3698
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 12, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@ViktorHoferViktorHoferViktorHofer approved these changes

@steveisoksteveisokAwaiting requested review from steveisok

Assignees

@jtschusterjtschuster

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@jtschuster@ViktorHofer

[8]ページ先頭

©2009-2025 Movatter.jp