DEV Community

Calin Baenen
Calin Baenen

Posted on

Why doesn't the "any" option work for the "-r" flag of .NET publish?

I read in this doc about the any RID, and it's the root for all other RIDs.
So, I try to use it to target all RIDs in the command

dotnet publish -c Release -r any --self-contained true
Enter fullscreen mode Exit fullscreen mode

And it throws the following error(s):

C:\Program Files (x86)\dotnet\sdk\5.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(99,5): error NETSDK1084: There is no application host available for the specified RuntimeIdentifier 'any'. [C:\Users\Administrator\Desktop\Projects\C#\langs\Janky\language\language.csproj]
C:\Program Files (x86)\dotnet\sdk\5.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(99,5): error NETSDK1084: There is no application host available for the specified RuntimeIdentifier 'any'. [C:\Users\Administrator\Desktop\Projects\C#\langs\Janky\language\language.csproj]
C:\Program Files (x86)\dotnet\sdk\5.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(99,5): error NETSDK1084: There is no application host available for the specified RuntimeIdentifier 'any'. [C:\Users\Administrator\Desktop\Projects\C#\langs\Janky\language\language.csproj]
C:\Program Files (x86)\dotnet\sdk\5.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(99,5): error NETSDK1084: There is no application host available for the specified RuntimeIdentifier 'any'. [C:\Users\Administrator\Desktop\Projects\C#\langs\Janky\language\language.csproj]
Enter fullscreen mode Exit fullscreen mode

(idk why it does it 4 times.)

So, how can I use any?
If I can't, is there any way to target all runtimes?
What is the default value of -r? And why can't I have a self-contained application w/o specifying a runtime?

If I can't have a self contained application w/o a specified runtime (because that may be equal to any), is there any way to get around it?

Thanks!
Cheers!

Top comments (6)

Collapse
 
fahminlb33 profile image
Fahmi Noor Fiqri • Edited

I don't think that you can use '-r any' with self-contained option simultaneously, because to produce a self-contained .NET app you'll need to specify an exact target platform.

I'll find the doc and link it here

Collapse
 
baenencalin profile image
Calin Baenen • Edited

any doesn't work regardless of if it's self-contained or not.

Collapse
 
baenencalin profile image
Calin Baenen

I assume this is because of the way applications actually work?

Collapse
 
vbilopav profile image
vbilopav

Write an issue to their repo, to have that included

Collapse
 
baenencalin profile image
Calin Baenen

Where's the repo?
And how do I write an issue (presumably) on GitHub?

Thanks!
Cheers!

Collapse
 
vbilopav profile image
vbilopav