vs code program wont run on another person's pc?

im trying to have my friend use a c# program i wrote in vs code the console just closes right after it opens (with some text on it sometimes but it closes too quick to copy it or see it) he uses windows 11 and i use windows 10 if that's any help.
19 Replies
Protogen Posting
Protogen PostingOP8mo ago
here's the code too:
Angius
Angius8mo ago
What editor you use does not matter How are you sending it? How are you packaging it?
Protogen Posting
Protogen PostingOP8mo ago
sending it as a zip file and the way im packaging it is just taking all the stuff from the debug folder in the bin folder that's what it said to do online when i looked up how to build it
Angius
Angius8mo ago
It said wrong, then What you want to do is publish it dotnet publish is the command
Protogen Posting
Protogen PostingOP8mo ago
ohhhhhhhhhh
Angius
Angius8mo ago
You're also doing a lot with paths, including getting the location of the exe
Protogen Posting
Protogen PostingOP8mo ago
makes sense
Angius
Angius8mo ago
Make sure none of those paths are actually user-dependent As in, all of them are either created by the program, or universal
Protogen Posting
Protogen PostingOP8mo ago
all of them are created by the program
Angius
Angius8mo ago
That should be fine, then
Protogen Posting
Protogen PostingOP8mo ago
alr nice btw they dont have to install .net right? just checkingf
Angius
Angius8mo ago
Ah, well, depends You can make it so that they don't need to install it, yeah But by default, yes, they would need to install at least the runtime, not the entire SDK If you want to package the .NET runtime with your app, here: $singlefile
MODiX
MODiX8mo 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
Angius
Angius8mo ago
That --self-contained flag is what does it
Protogen Posting
Protogen PostingOP8mo ago
what do i put in runtime identifier? like the .net version it uses?
Angius
Angius8mo ago
No, the system identifier, basically win-32 for example Check the link to the RID catalogue Actually, win-x64 This is the one for Windows
Protogen Posting
Protogen PostingOP8mo ago
ok nice dotnet publish -c Release -r win-x64 -p:PublishSingleFile=true so this'd work? just checking
Angius
Angius8mo ago
Yep
Protogen Posting
Protogen PostingOP8mo ago
nice
Want results from more Discord servers?
Add your server