microsoft / dotnet

This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
https://devblogs.microsoft.com/dotnet/
MIT License
14.34k stars 2.21k forks source link

`-r any` doesn't work. #1295

Closed CalinZBaenen closed 2 years ago

CalinZBaenen commented 3 years ago

When ever I do dotnet public -r any --self-contained true on my CSharp project. it provides the error

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]

I tried removing --self-contained but the issue persisted.

DanielGlick commented 2 years ago

@CalinZBaenen did you ever get an answer here? I am experiencing this issue

CalinZBaenen commented 2 years ago

@DanielGlick45 Nope. That's one of the reasons I was deterred from C#.
I'm sorry you're experiencing this issue and I hope you find a solution.

baronfel commented 2 years ago

Hello @CalinZBaenen - can you open this at dotnet/sdk? We can't move issues across orgs, and the team that works on the SDK doesn't have visibility into this issue here.

CalinZBaenen commented 2 years ago

@baronfel

We can't move issues across orgs

"org"? As in "organization"? The context is vague.

Hello @CalinZBaenen - can you open this at dotnet/sdk?

No because I have no intention of returning to this issue.
However, if you or @DanielGlick45 would like to, as would seem obvious, feel free to.

baronfel commented 2 years ago

Sorry, I meant github organizations - issues can only be moved between dotnet/runtime and dotnet/sdk, for example, not from microsoft/dotnet to dotnet/sdk. I asked mostly because I imagined you had more context or details that you might have wanted to submit. I'll try to repro this when I have time and open a corresponding issue on the SDK repo.

CalinZBaenen commented 2 years ago

I imagined you had more context or details that you might have wanted to submit.

Nope. I posted what I wanted to post.
With that said, I probably should have posted more since this Issue seems somewhat vague, but I wasn't real sure what else to include or what to include based on the error.

CalinZBaenen commented 2 years ago

Also, unrelated, but @baronfel, are þorn and eð readable (to you)? In the browser the latter character looks a little messy on the top due to pixelation.
I want to start switching to using them anywhere except source-code.

baronfel commented 2 years ago

At my chosen font size those characters are fine, the second grapheme is a little cluttered but I also use a relatively small font.

CalinZBaenen commented 2 years ago

Alright, thank you. \:)

richlander commented 2 years ago

dotnet public -r any --self-contained true

-r any and --self-contained don't match as options. As designed, self-contained apps can only ever be for one runtime/RID, in large part because they contain a runtime. In a counter-factual design, we could make any download all the runtimes and all the hosts. I don't think anyone wants that.

This is the only way to use any:

 % dotnet build -r any --self-contained false -p:UseAppHost=false
% ls bin/Debug/net6.0/any 
test.deps.json      test.pdb
test.dll        test.runtimeconfig.json

It produces an app w/no executable.

That said, it appears that it doesn't do anything useful. I added a reference to SkiaSharp and didn't get what I thought was a useful result. I recall @vitek-karas telling me that any doesn't do anything useful. This seems to be proving the point.

What are you trying to do?

CalinZBaenen commented 2 years ago

@richlander I'm not sure what @DanielGlick45 is trying to do or if they figured it out, but originally I was foolishly trying to make an executable that'd work on any device without having to build it for each target.

richlander commented 2 years ago

Right. That's not supported. It's not a .NET thing but a computer thing. No one enables that.

.NET Framework executables on Windows are very special. That make it seem like anything works. Having supported that scenario for many years, I can report that they are indeed very special.

CalinZBaenen commented 2 years ago

Right. That's not supported. It's not a .NET thing but a computer thing. No one enables that.

I was a (younger) kid, my rationale was that .NET was similar to Java's Runtime because of everything else in C# was a(n) rip-off of exact match for Java's stuff.

richlander commented 2 years ago

Sure. We support that scenario, too. It's dotnet foo.dll. Works fine.

CalinZBaenen commented 2 years ago

Sorry; huh?

richlander commented 2 years ago

Here's your "any app":

% dotnet build -o app
% dotnet app/test.dll 
Hello, World!

That pattern will work on any OS with a .NET runtime installed.

CalinZBaenen commented 2 years ago

Neat.
Is it fine if that's how one decides to make and distribute their program?

richlander commented 2 years ago

Yes. It is supported and various scenarios use just that. It works A-OK for console apps and web apps. It works poorly for client apps. Knock yourself out with this pattern!

CalinZBaenen commented 2 years ago

Poorly for client apps because they need to be run with a command? :P /prob-obv

richlander commented 2 years ago

Right. Users except the double-click EXE experience. There are ways to work around that with scripts, but it is a pain.