✅ 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
Sehra
Sehra2d ago
dotnet publish -c Release --self-contained you can also add -p:PublishSingleFile=true to pack it all into one exe
.gg/cheatforge
.gg/cheatforgeOP2d ago
@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?
Sehra
Sehra2d ago
do you have a csproj file?
.gg/cheatforge
.gg/cheatforgeOP2d ago
what is that
.gg/cheatforge
.gg/cheatforgeOP2d ago
No description
.gg/cheatforge
.gg/cheatforgeOP2d ago
i have this the main one with my code tho is triggerfinder.cs
Sehra
Sehra2d ago
and what does that code do?
.gg/cheatforge
.gg/cheatforgeOP2d ago
its an extension for my game finds triggers that way you can use em
FusedQyou
FusedQyou2d ago
If you use Visual Studio, you can easily publish your project by right clicking the .csproj file and selecting "publish"
.gg/cheatforge
.gg/cheatforgeOP2d ago
No description
.gg/cheatforge
.gg/cheatforgeOP2d ago
where
FusedQyou
FusedQyou2d ago
For Visual Studio Code, you open a command line interface and type the publish command indicated above
.gg/cheatforge
.gg/cheatforgeOP2d ago
all i did so far was do a command ane make those extra files the program.cs and csproj
FusedQyou
FusedQyou2d ago
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?
.gg/cheatforge
.gg/cheatforgeOP2d ago
yes from the plugins page thing i have that installed
FusedQyou
FusedQyou2d ago
Then perhaps that includes it, but idk
.gg/cheatforge
.gg/cheatforgeOP2d ago
so, im sorry im kind of slow, but, so then how do i make the exe
FusedQyou
FusedQyou2d ago
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.
FusedQyou
FusedQyou2d ago
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 code
FusedQyou
FusedQyou2d ago
dotnet publish command - .NET CLI
The dotnet publish command publishes a .NET project or solution to a directory.
.gg/cheatforge
.gg/cheatforgeOP2d ago
No description
FusedQyou
FusedQyou2d ago
This is the actual command. Take note of the Arguments and Options you can supply if you want that
dotnet publish command - .NET CLI
The dotnet publish command publishes a .NET project or solution to a directory.
FusedQyou
FusedQyou2d ago
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
.gg/cheatforge
.gg/cheatforgeOP2d ago
oh so theirs an error in my code
FusedQyou
FusedQyou2d ago
Also, you seem to be using Windows Forms which is not something you should use anymore unless you really have to
.gg/cheatforge
.gg/cheatforgeOP2d ago
wym windows forms
FusedQyou
FusedQyou2d ago
Yes, and if VSCode is configured properly it would indicate this
Sehra
Sehra2d ago
you probably want to start with dotnet new winforms template instead of console
FusedQyou
FusedQyou2d ago
Idk 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
.gg/cheatforge
.gg/cheatforgeOP2d ago
all im trying to do is convert my C# that I have and make it an exe
FusedQyou
FusedQyou2d ago
Did this code work, ever?
Sehra
Sehra2d ago
did you write the code?
.gg/cheatforge
.gg/cheatforgeOP2d ago
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
FusedQyou
FusedQyou2d ago
Then you will have to fix this code first
Sehra
Sehra2d ago
but it doesn't compile, how did you run it?
FusedQyou
FusedQyou2d ago
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
.gg/cheatforge
.gg/cheatforgeOP2d ago
ok, how can i change to the new and updated one
FusedQyou
FusedQyou2d ago
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
.gg/cheatforge
.gg/cheatforgeOP2d ago
ok
SG97
SG972d ago
I would not develop WinForms on Visual Studio Code oh, they left/got banned? they got banned
FusedQyou
FusedQyou2d ago
Welp, good riddance I assume whatever they are making is either for malicious intent, or they were evading
Pobiega
Pobiega2d ago
someone with the name "cheatforge" making cheats? hardly unexpected :p
FusedQyou
FusedQyou2d ago
Well, yeah, I generally don't associate the names of folks with their hobby 😄

Did you find this page helpful?