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
here's the code too:
What editor you use does not matter
How are you sending it?
How are you packaging it?
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
It said wrong, then
What you want to do is publish it
dotnet publish
is the commandohhhhhhhhhh
You're also doing a lot with paths, including getting the location of the exe
makes sense
Make sure none of those paths are actually user-dependent
As in, all of them are either created by the program, or universal
all of them are created by the program
That should be fine, then
alr nice
btw they dont have to install .net right?
just checkingf
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
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: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
That
--self-contained
flag is what does itwhat do i put in runtime identifier?
like the .net version it uses?
No, the system identifier, basically
win-32
for example
Check the link to the RID catalogue
Actually, win-x64
This is the one for Windowsok nice
dotnet publish -c Release -r win-x64 -p:PublishSingleFile=true
so this'd work?
just checkingYep
nice