Program won’t run with just .net runtime [Answered]
So my program that I published and is targeting .net 6 won’t run when the pc has just .net 6 runtime installed. It should be able to run with just this right? It doesn’t start working until I also install the .net 6 sdk, which it shouldn’t need right? Am I publishing my program incorrectly to cause this or what could it be?
21 Replies
Well, how did you publish it?
Through Vs as single file. But it seems the issue was that the runtime only contained the .netcore app runtime. Once I installed the sdk, it added the aspnetcore and windows desktop runtime
Not sure why windowsdesktop runtime wouldn’t be included in the runtime install, but ya seems that’s what was missing
There's only one runtime
There's no special ASP.NET runtime, or WPF runtime
@Angius this says otherwise
Huh
.Net runtimes installed:
ASP.NET Core / Desktop require a lot of additional libraries, so it doesn't make sense to ship them with every .NET runtime install. The Desktop libraries are Windows-specific. You can look at the installers here: https://dotnet.microsoft.com/en-us/download/dotnet/6.0
Gotcha, so it needing the sdk is normal? Or is there a way I can publish it to not need it? Cause there’s libs I obv can’t not use
You can try $selfcontained
See $singlefile
$singlefile
dotnet publish -c Release -r <runtime identifier> -p:PublishSingleFile=true
Use of -r
|--runtime
implies --self-contained true
. Add --self-contained false
to publish as runtime-dependent.
-r ...
and -p:PublishSingleFile=true
can be moved to .csproj as the following properties:but to target multiple RIDs, you have to use dotnet publish
with the -r
option for each RID.
You can also add -p:IncludeNativeLibrariesForSelfExtract=true
to include native libraries (like Common Language Runtime dlls) in the output executable.
https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file
https://docs.microsoft.com/en-us/dotnet/core/rid-catalog
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publishCreate a single file for application deployment - .NET
Learn what single file application is and why you should consider using this application deployment model.
.NET Runtime Identifier (RID) catalog
Learn about the Runtime Identifier (RID) and how RIDs are used in .NET.
That’s what I used
Hmm
Just with the self-contained option
You created a single file, IIRC
You can do that + embed the necessary runtime
Single file along with self-contained
I think you still need to install the .NET Desktop Runtime if you do singlefile, self-contained with desktop. I'm not sure though.
Assuming you're publishing a WinForms/WPF app.
Yes
Ok ty
I feel your pain
Had the same issue
Nothing worked (was a very simple project)
And never got it working ;D
self-contained + single file (WPF)
That's not true, there are three runtime packages/installers
✅ This post has been marked as answered!