question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support building for multiple RIDs, similar to how TargetFrameworks works

See original GitHub issue

Steps to reproduce

Have project file

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFrameworks>netcoreapp2.1;netcoreapp2.0</TargetFrameworks>
    <RuntimeIdentifiers>win;linux-x64</RuntimeIdentifiers>
  </PropertyGroup>
</Project>

run dotnet build

Expected behavior

Builds .dlls, that is the cross join between the RuntimeIdentifiers and TargetFrameworks

Actual behavior

Tries to build the any rid for each framework in TargetFrameworks but can’t because the any rid is unbuildable on this project.

Environment data

dotnet --info output:

.NET Core SDK (reflecting any global.json): Version: 2.1.302 Commit: 9048955601

Runtime Environment: OS Name: debian OS Version: 9 OS Platform: Linux RID: debian.9-x64 Base Path: /usr/share/dotnet/sdk/2.1.302/

Host (useful for support): Version: 2.1.2 Commit: 811c3ce6c0

.NET Core SDKs installed: 2.1.302 [/usr/share/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

@onovotny: I tried your MSBuild.Sdk.Extras version 1.6.30-preview and 1.7.1-preview; however while it can make a reference assembly just fine it doesn’t seem to convince dotnet build or dotnet pack to do the right thing with RuntimeIdentifiers. 1.6.40 seems to be brain-damaged and the builds bomb.

dotnet /usr/share/dotnet/sdk/2.1.302/MSBuild.dll doesn’t work either.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:10
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

10reactions
caizixiancommented, Apr 23, 2020

The scenario could be interesting for how things will change in “.NET 5”…

No idea how/if TFMs are going to evolve but I could also easily see a world where we could do

<PropertyGroup>
  <TargetFramework>net5.0</TargetFramework>
  <RuntimeIdentifiers>iOS12.0-arm64;iOS12.0-x64;android-arm;android-arm64;android-x64</RuntimeIdentifiers>
</PropertyGroup>

or something similar instead of monoandroid60 and friends. (though I don’t think this would be RIDs)

This is a valid scenario.

I’d argue that on desktop platforms, it also makes sense to have, e.g. <RuntimeIdentifiers>osx-x64;linux-x64</RuntimeIdentifiers>, so that I can get multiple executables, one for each RID, with a single dotnet publish. Of course, I can run dotnet publish -r multiple times, but it’s more desirable to have it built into the build system.

2reactions
dasMullicommented, May 8, 2019

The scenario could be interesting for how things will change in “.NET 5”…

No idea how/if TFMs are going to evolve but I could also easily see a world where we could do

<PropertyGroup>
  <TargetFramework>net5.0</TargetFramework>
  <RuntimeIdentifiers>iOS12.0-arm64;iOS12.0-x64;android-arm;android-arm64;android-x64</RuntimeIdentifiers>
</PropertyGroup>

or something similar instead of monoandroid60 and friends. (though I don’t think this would be RIDs)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Support multiple .NET Framework versions in your project file
Description of the various methods to target multiple .NET Framework versions from within a single NuGet package in your project file.
Read more >
Non-Trivial Multi-Targeting with .NET | by Brad Robinson
When building for NetCore target frameworks, dotnet build should recognize and build assemblies targeted for netstandard as they're compatible.
Read more >
NET Core RuntimeIdentifier vs TargetFramework
The <TargetFramework> (or <TargetFrameworks> when you want have multiple targets, such as net451 , one or multiple netstandard1.x etc).
Read more >
Targeting builds for multiple frameworks and machines
I've recently starting working on a new project in my spare time, DbUpgrader, and I'm trying to work on it for at least...
Read more >
Are Runtime Identifiers supported? - Build/Test Issues
Being able to test multiple RIDs is very similar to being able to test multiple target frameworks, but if it isn't already supported...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found