.net core 生成主项目时,运行时标识符在从属项目中不可用

.net core 生成主项目时,运行时标识符在从属项目中不可用,.net-core,msbuild,csproj,.net-core-3.1,.net Core,Msbuild,Csproj,.net Core 3.1,我在一个依赖项目(称为DAL)中有一个简单的预构建目标: msbuild为什么要这样做?在生成/发布主项目时,如何将运行时标识符信息传递给DAL项目 .NET Core SDK版本:3.1.402,所有项目的目标.NET Core 3.1 谢谢 更新: 我在csproj文件中添加了以下元素: win-x64;linux-x64 现在输出为: Determining projects to restore... All projects are up-to-date for restore.

我在一个依赖项目(称为DAL)中有一个简单的预构建目标:

msbuild为什么要这样做?在生成/发布主项目时,如何将运行时标识符信息传递给DAL项目

.NET Core SDK版本:
3.1.402
,所有项目的目标
.NET Core 3.1

谢谢

更新: 我在csproj文件中添加了以下元素:

win-x64;linux-x64

现在输出为:

 Determining projects to restore...
 All projects are up-to-date for restore.
 DAL -> C:\Source\...\DAL\bin\Debug\netcoreapp3.1\linux-x64\DAL.dll
 RuntimeIdentifier value is: linux-x64
 DAL -> C:\Source\...\DAL\bin\Debug\netcoreapp3.1\DAL.dll
 RuntimeIdentifier value is:
 Core -> C:\Source\...\Core\bin\Debug\netcoreapp3.1\Core.dll
 Transformer -> C:\Source\...\Transformer\bin\Debug\netcoreapp3.1\linux-x64\Transformer.dll

似乎解决方法是设置
运行时标识符
元素,这是设计的吗?

这是设计的。运行时标识符更多的是将要发布的入口点应用程序项目,而不是库项目

以前(1.0/preview timeframe),RID(运行时标识符)被转发,并导致大量重建和NuGet与构建1.0/1.1运行时NuGet包的方式不一致

目前,分发特定于RID的程序集的最佳方法是构建一个NuGet包,将程序集放置在右侧


但是,也可以设计运行时代码来检查选择要使用的正确API或要加载的正确程序集。

谢谢Martin!我之所以需要它,是为了在构建主项目时在依赖项目中安装一个特定于RID的nuget包(IBM DB2 EF Core)。我是这样做到的:
Removing Properties for project "..\DAL\DAL.csproj":
  TargetFramework
  RuntimeIdentifier
 Determining projects to restore...
 All projects are up-to-date for restore.
 DAL -> C:\Source\...\DAL\bin\Debug\netcoreapp3.1\linux-x64\DAL.dll
 RuntimeIdentifier value is: linux-x64
 DAL -> C:\Source\...\DAL\bin\Debug\netcoreapp3.1\DAL.dll
 RuntimeIdentifier value is:
 Core -> C:\Source\...\Core\bin\Debug\netcoreapp3.1\Core.dll
 Transformer -> C:\Source\...\Transformer\bin\Debug\netcoreapp3.1\linux-x64\Transformer.dll