C
C#13mo ago
Itskillerluc

❔ should i use C# for a standalone exe or should i use C++ or something else

idk what to use, i have quite a lot of java experience thats why i thought i would use C# but i need a standalone executalbe and afaik thats only possible with like a really old C# version, or am i wrong there?
30 Replies
cap5lut
cap5lut13mo ago
u r wrong ;p ofc it is up to the actual use case what to use, but generally speaking there is single file deployment https://learn.microsoft.com/en-us/dotnet/core/deploying/single-file/overview?tabs=cli
Create a single file for application deployment - .NET
Learn what single file application is and why you should consider using this application deployment model.
Itskillerluc
Itskillerluc13mo ago
oh even for the newest version? nice and if you need like a library? or does the sdk already have pretty much everything you need?
cap5lut
cap5lut13mo ago
(basically deploying the runtime urself, just like u were able to choose in java to either just provide a jar and having the user install the jvm, or bring it urself) these will be embedded as well
Itskillerluc
Itskillerluc13mo ago
wdym with the latter you mean embedding the runtime within the app? wouldnt that create like huge apps
cap5lut
cap5lut13mo ago
well, i guess u know about eclipse/intellj, these bring their own jvm runtimes, instead of requiring u to install one (well u still need a jdk to compile ur stuff, but thats more regarding their functionality than how the application works on its own)
Itskillerluc
Itskillerluc13mo ago
well fair
cap5lut
cap5lut13mo ago
it does, but there is a trimming option, that means, stuff that isnt used will be thrown out to reduce the size
Itskillerluc
Itskillerluc13mo ago
its a pretty small app so it should definetly not be like 1 GB altho i doubt it would get that big
cap5lut
cap5lut13mo ago
yeah, with trimming iirc a hello world console app is like 2-4mb
Itskillerluc
Itskillerluc13mo ago
oh fair
cap5lut
cap5lut13mo ago
and there wont be much of a change if u dont add a lot dependencies
Itskillerluc
Itskillerluc13mo ago
thats not bad at all ye well i do want a window to pop up but and a video to play and some user interaction too so it might get a bit more complicated then but ye
cap5lut
cap5lut13mo ago
well, then it will grow quite a bit as u have a lot more dependencies, but thats also just a couple of mega bytes at max
Itskillerluc
Itskillerluc13mo ago
ok itll be under 100 MB? cuz ill take that
cap5lut
cap5lut13mo ago
the size heavy part is basically ur embedded resources, like icons for the toolbar, etc
Itskillerluc
Itskillerluc13mo ago
ye and the videos i guess you could download them at runtime but thats kind of sketchy too
cap5lut
cap5lut13mo ago
well videos are big, if u embed them ur binary will grow a lot ofc. but usually u dont embed these but bring them along as external resources via installs a game for example isnt just one big exe either ;p
Itskillerluc
Itskillerluc13mo ago
ye but i cant have that, i just need a run once and done, no user input required and as little things that can be blocked by some stupid anti virus as possible, im not creating a virus but yk how those things are, installers usually require admin and stuff so if an app downloads things and stuff that jjust sounds like more stuff that can go wrong
cap5lut
cap5lut13mo ago
well, to be on the safe side u embed the resources then
Itskillerluc
Itskillerluc13mo ago
ye video quality doesnt have to be great anywyas and the longest one is like 4 minutes so maybe it wont be that bad
cap5lut
cap5lut13mo ago
well then its mainly about how good u can reduce the sizes of the videos, not the code u write itself
Itskillerluc
Itskillerluc13mo ago
XD fair enough Would base64 encoding help Tbh there is probably a more efficient compression algorithm out there
cap5lut
cap5lut13mo ago
base64 will make it bigger for sure, u can embed the videos as raw binary data, the tools u use to create/edit the videos will know better how to compress the sizes using codecs these tools and which library u use for playing the video are the deciding factors here
Shinigami
Shinigami13mo ago
I had to convert a forms app to exe, and give or take the exe size was ~150mb with .net environment included
cap5lut
cap5lut13mo ago
that sounds like u didnt enable trimming
Chiyoko_S
Chiyoko_S13mo ago
I don't think desktop apps can be trimmed
cap5lut
cap5lut13mo ago
u can even trim avalonia apps, so yes it also applies to desktop apps
Chiyoko_S
Chiyoko_S13mo ago
by desktop apps I meant WPF / WinForms and if you try trimming a WPF app:
C:\Program Files\dotnet\sdk\8.0.100-preview.4.23260.5\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInf
erence.targets(233,5): error NETSDK1168: WPF is not supported or recommended with trimming enabled. Please go to https:
//aka.ms/dotnet-illink/wpf for more details.
C:\Program Files\dotnet\sdk\8.0.100-preview.4.23260.5\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInf
erence.targets(233,5): error NETSDK1168: WPF is not supported or recommended with trimming enabled. Please go to https:
//aka.ms/dotnet-illink/wpf for more details.
Shinigami
Shinigami13mo ago
Ye, i wasn't sure what would be removed and how it'd effect the app And also it's not possible like @chiyoko_s said It's possible but not supported/suggested*
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts