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
Angius
Angius2y ago
Well, how did you publish it?
primetime43
primetime432y ago
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
Angius
Angius2y ago
There's only one runtime There's no special ASP.NET runtime, or WPF runtime
primetime43
primetime432y ago
primetime43
primetime432y ago
@Angius this says otherwise
Angius
Angius2y ago
Huh
primetime43
primetime432y ago
.Net runtimes installed:
Klarth
Klarth2y ago
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
primetime43
primetime432y ago
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
Angius
Angius2y ago
You can try $selfcontained
MODiX
MODiX2y ago
See $singlefile
Angius
Angius2y ago
$singlefile
MODiX
MODiX2y ago
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:
<RuntimeIdentifier>runtime identifier</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>runtime identifier</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
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-publish
Create 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.
primetime43
primetime432y ago
That’s what I used Hmm
Angius
Angius2y ago
Just with the self-contained option You created a single file, IIRC You can do that + embed the necessary runtime
primetime43
primetime432y ago
Single file along with self-contained
Klarth
Klarth2y ago
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.
primetime43
primetime432y ago
Yes Ok ty
qqdev
qqdev2y ago
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)
phaseshift
phaseshift2y ago
That's not true, there are three runtime packages/installers
Accord
Accord2y ago
✅ This post has been marked as answered!
Want results from more Discord servers?
Add your server
More Posts
NullReferenceException Object reference not set to an instance of an object```cs List<Effects> effectsList = activePlayerEffects[targetPlayer] ?? new List<Effects>(); ``` someDbContext.SaveChangesAsync has no effect on the collection of changed objectsHi. I get products collection from dbContext, change some values and want to save it in the databaseWindowsIdentity claims don't include all AD attributes, how do I fix that?I'm using windows authentication and want to display a user's full name, however on inspection the ihow to create a jwt for an existing user in identityI am looking to create a new JWT and validate it... for using tiwht signalr. so i want to know how tNeed help finding memory leak [Answered]We have a solution with a mix of VB and C# projects. Most of them in VB. We have a logger factory wrEF 6 - Creating entity with n-n```cs PostDtoWrite_2 newpost = new PostDtoWrite_2(); newpost.Title = request.Title; newpHow can I make invisible Console NOT winformI have a project but i need to make invisible, but i can not to make it.namespace missing imports after copying class [Answered]Hi guys, I am struggling with a problem for a few weeks. So I have a ASP.NET Website project (Not wHow to combine null coascence and ternary operator?Hello, I have a string variable A. And I want to fill thid string A with value Yes if a bool is true.NET CORE 6 - Injecting IDbConnection... is it good practice?I have an api to build and using dapper - IDbConnection. Atm i have an instance of IDbConnection for