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

User Story: Package authors can multi-target between runtime identifiers (RID) #5699

Closed
terrajobst opened this issue Dec 4, 2020 · 16 comments
Assignees
Labels
bulk-closed Team:NuGet Team:SDK User Story A single user-facing feature. Can be grouped under an epic.

Comments

@terrajobst
Copy link
Member

Spec TBD

@terrajobst terrajobst added the User Story A single user-facing feature. Can be grouped under an epic. label Dec 4, 2020
@terrajobst terrajobst self-assigned this Dec 4, 2020
@terrajobst terrajobst changed the title Package authors can multi-target between runtime identifiers (RID) User Story: Package authors can multi-target between runtime identifiers (RID) Dec 4, 2020
@terrajobst terrajobst added the Priority:0 Work that we can't release without label Dec 4, 2020
@danmoseley
Copy link
Member

Currently multitargeting is supported via TargetFrameworks but not really for multiple RID's. In our own build, we have to do custom build gymnastics to achieve this.

@danmoseley
Copy link
Member

The libraries team part here is representing our needs as we'd like to move over to this supported mechanism once it exists.

@cdmihai
Copy link

cdmihai commented Feb 1, 2021

I think that adding a new first class concept to MSBuild, that of arbitrary build dimensions, would solve these 'we want to bolt on yet another hardcoded dimension' types of issues once and for all. A build dimension could be defined as a key value map: {foo:"bar", zoo:"roo"} {TargetFramework:"net472", RuntimeId:"win", Configuration="Debug", Architecture="x64"}. In MSBuild they could be expressed via regular items, or we could introduce new MSBuild expressions with well defined semantics. The engine could know about them to make it easier to specify multitargeting and whatnot. We could also borrow BuildXL's design of build dimensions

@danmoseley
Copy link
Member

danmoseley commented Feb 1, 2021

We should get an engineering owner assigned to this, like every P0 story, to avoid disconnects. It can always change later. It would most likely be the M1 where most of the work will happen. Is that you @marcpopMSFT or someone on your team?

@marcpopMSFT
Copy link
Member

My understanding is that the largest set of the work for this would be from NuGet so @aortiz-msft would probably be the M1 owner.

@danmoseley
Copy link
Member

@aortiz-msft thoughts?

@ViktorHofer
Copy link
Member

I think for this a decent amount of work needs to be done by MSBuild, NuGet and the SDK.

@aortiz-msft
Copy link

Yes, we discussed this in our Monday meeting last week, and this is not something we think we can deliver in NET 6.0. However, let's understand the customer feedback around this and start validating the problem and solution hypotheses.

@clairernovotny
Copy link
Member

As a head's up, the Extras supports this for the inner compile loop and building nuget packages:
https://github.com/novotnyllc/MSBuildSdkExtras#creating-per-runtimeidentifier-packages

It doesn't likely handle P2P references in an intelligent way.

@hansmbakker
Copy link

I'm looking for a way to have multitargeting for different RIDs from a single class library project - including using the RID as a compile-time condition in the .csproj to reference RID-specific dependencies, like it is possible with TFMs now. This would not only enable building the correct binaries, but it would also allow for using the correct code at compile-time using #if rather than using runtime-checks like OperatingSystem.IsLinux().

My usecase would be to create a single NuGet package (class library) that has a windows-specific and a linux-specific implementation, which could be referenced through a common API surface in a consuming head project (abstracting away the platform differences). Depending on the publishing RID of the consuming head project, the nuget package for windows or linux would be restored. By using the RID as a condition in the .csproj file, additional platform-specific dependencies could be added.

Since there is no linux-specific TFM, I cannot multitarget a project in the usual way now.

See also dotnet/sdk#27061

@terrajobst is this still targeted for the 7.x timeframe?

@marcpopMSFT
Copy link
Member

CC @baronfel for visibility. This is not in plans for a 7.0 release. A feature being discussed that might help here is TFM aliasing which would allow aliases to include the RID but that isn't officially planned yet.

@terrajobst terrajobst removed the Priority:0 Work that we can't release without label Mar 21, 2023
@terrajobst terrajobst removed this from the 7.0 milestone Mar 21, 2023
@mairaw
Copy link
Contributor

mairaw commented May 26, 2023

Bulk closing .NET 6 epics and user stories. If you think this issue was closed in error, please reopen the issue and update it accordingly.

@mairaw mairaw closed this as completed May 26, 2023
@hansmbakker
Copy link

hansmbakker commented May 26, 2023

Please reopen this @terrajobst @mairaw @marcpopMSFT @baronfel

@s1495k043
Copy link

Is this in the plan? This situation make me crazy.
image

@mairaw
<