Skip to content

RID-based restore should not be necessary for PSCD apps #34198

@richlander

Description

@richlander

This is my experience.

root@015a54c22b5a:/app# cat *.csproj
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <PublishSelfContained>true</PublishSelfContained>
  </PropertyGroup>

</Project>
root@015a54c22b5a:/app# dotnet restore
  Determining projects to restore...
  All projects are up-to-date for restore.
root@015a54c22b5a:/app# dotnet publish --no-restore
MSBuild version 17.7.0+5785ed5c2 for .NET
/usr/share/dotnet/sdk/8.0.100-preview.6.23330.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(314,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [/app/app.csproj]
/usr/share/dotnet/sdk/8.0.100-preview.6.23330.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1047: Assets file '/app/obj/project.assets.json' doesn't have a target for 'net8.0/linux-x64'. Ensure that restore has run and that you have included 'net8.0' in the TargetFrameworks for your project. You may also need to include 'linux-x64' in your project's RuntimeIdentifiers. [/app/app.csproj]
root@015a54c22b5a:/app# dotnet restore -r linux-x64
  Determining projects to restore...
  Restored /app/app.csproj (in 2.16 sec).
root@015a54c22b5a:/app# dotnet publish --no-restore
MSBuild version 17.7.0+5785ed5c2 for .NET
/usr/share/dotnet/sdk/8.0.100-preview.6.23330.14/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(314,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [/app/app.csproj]
  app -> /app/bin/Release/net8.0/linux-x64/app.dll
  app -> /app/bin/Release/net8.0/linux-x64/publish/

I assume this would be fixed if RID-specific was the default. It's very odd that apps with PublishSelfContained are portable for build.

@agocke @nagilson

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions