✅ executing
got a question im kind of new but i have a projecet in C# i want to make into like a file that i can just have on my pc share with people and execute how would i do this please help and thankk u to all that do relaly appreciate it
43 Replies
dotnet publish -c Release --self-contained
you can also add -p:PublishSingleFile=true
to pack it all into one exe@Sehra i just have one like file its just ts.cs in vscode theirs no other txt or anything like that
so i would do which one the first one or second one u sent?
do you have a csproj file?
what is that
i have this
the main one with my code tho is triggerfinder.cs
and what does that code do?
its an extension for my game finds triggers
that way you can use em
If you use Visual Studio, you can easily publish your project by right clicking the .csproj file and selecting "publish"
where
For Visual Studio Code, you open a command line interface and type the publish command indicated above
all i did so far was do a command ane make those extra files
the program.cs and csproj
This is Visual Studio Code, not Visual Studio. Unless it's included through a plugin, I don't think there is a dedicated publish command
Do you have the C# Devkit installed as a plugin/extension?
yes
from the plugins page thing
i have that installed
Then perhaps that includes it, but idk
so, im sorry im kind of slow, but, so then how do i make the exe
Publish a .NET console application using Visual Studio Code - .NET
Learn how to use Visual Studio Code and the .NET CLI to create the set of files that are needed to run a .NET application.
Follow this
Note the
publish
comment in dotnet publish
has various different options you can pass to it. A basic publish command generates your application using default configuration whch is fine as it is
You can do a lot of toher things to improve it, but most require stricter codedotnet publish command - .NET CLI
The dotnet publish command publishes a .NET project or solution to a directory.
dotnet publish command - .NET CLI
The dotnet publish command publishes a .NET project or solution to a directory.
This is an issue with your code in general. I can't help with that. You have to include the right namespaces or the code will not compile
This has nothing to do with publishing
oh so theirs an error in my code
Also, you seem to be using Windows Forms which is not something you should use anymore unless you really have to
wym windows forms
Yes, and if VSCode is configured properly it would indicate this
you probably want to start with
dotnet new winforms
template instead of consoleIdk what you are even trying to do here
Did you copy paste code into files, hoping it works?
You seem to run a project with Winforms code, but Winforms isn't set up
all im trying to do is convert my C# that I have and make it an exe
Did this code work, ever?
did you write the code?
yes it did, i just want it to an exe tho that way i dont have to open VScode and run it i can just double click it
Then you will have to fix this code first
but it doesn't compile, how did you run it?
And we can't help you with that unless you figure out what broke it, if it worked before
With that I meant that Winforms is an old and shitty UI framework. At the very least you'd use WPF now, or different UI frameworks. Anything but Winforms
It's fine for very basic tests, but not actual applications
ok, how can i change to the new and updated one
idk, but that's not the problem anyway
Figure out why it is broken suddenly. Your code should not build in general so you can't publish it either
ok
I would not develop WinForms on Visual Studio Code
oh, they left/got banned?
they got banned
Welp, good riddance
I assume whatever they are making is either for malicious intent, or they were evading
someone with the name "cheatforge" making cheats? hardly unexpected :p
Well, yeah, I generally don't associate the names of folks with their hobby 😄