C
C#2mo ago
🌺 Kitty

✅ build one file

Hello, i want build my project on 1 executable but idk who to do it
5 Replies
🌺 Kitty
🌺 Kitty2mo ago
i look on youtube, but tutos are 1 or 2 years old
reflectronic
reflectronic2mo ago
$singlefile
MODiX
MODiX2mo ago
dotnet publish -c Release -r <runtime identifier> -p:PublishSingleFile=true Use of -p:PublishSingleFile=true implies --self-contained true. Add --self-contained false to publish as runtime-dependent. -r RID and -p:PublishSingleFile=true can be moved to .csproj as the following properties:
<RuntimeIdentifier>RID</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>RID</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. You might want to instead publish your application compiled Ahead Of Time to native code, see $nativeaot for examples. Single file publishing | Runtime Identifier (RID) catalog | dotnet publish
blueberriesiftheywerecats
Btw does the one who open exe file like this need to have .net installed?
Pobiega
Pobiega2mo ago
that depends on --self-contained if its NOT self contained, yes if it is self-contained, no note that a self-contained exe is much much larger than a non-selfcontained one there is also ahead of time (AOT) compilation, which removes the need for a runtime all-together, but has restrictions on what kind of code you can write (example, reflection is very limited in AOT)
Want results from more Discord servers?
Add your server