C
C#2mo ago
Silme94

Windows Forms EXE

When i compile my app to Release, the machine require dotnet or else it shows a messagebox thats tell to install it, however i dont wanna this.
5 Replies
leowest
leowest2mo 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
leowest
leowest2mo ago
you need to set it as self contained so that it packs the runtime with the file without self contained then yes the target machine would require to install or have it installer before ahead unless you use .net framework, but that assumes your app will run on windows only(since you're using winforms not a problem) and will be limited by the language features of that version if you're publishing thru visual studio community u should see an option "framework dependent" u would change that to "self contained"
leowest
leowest2mo ago
No description
leowest
leowest2mo ago
@Silme94 did that made sense to u?