❔ what template do i use
what template hsould i use i think winforms right? i just want to be able to open apps like notepad and images inside of my own app, like its embedded basically. like i want to launch something else but i need to be able to control it like its my own app
38 Replies
If you just need to open other apps from your app then you can use a regular console application.
oh and i do need to be able to build it to a one file thing
WinForms is generally only for legacy Windows-only GUI apps
and console has events like this https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.application.applicationexit?view=windowsdesktop-7.0 ?
That's the current application
what
In WinForms, that event fires when the user tries to close the current application.
yes?
so when you close your app
yes
What do you actually need? What are you trying to make?
yes i launch something like notepad and i want to do somthing when someone closes it
So you want to launch Notepad from inside your app, then do something when the user closes Notepad?
well my app just launches notepad directly
my app doesnt have its own ui
but basically yes
right
but maybe something in the console ye
yeah I'm pretty sure you don't need WinForms for that
oh
just the console?
yeah that's fine
okie
I'm unsure of how to detect when a specific app closes, though.
and what is the o
is it just to do the name
its not in the --help for dotnet
The
-o <directory>
specifies in what directory the app should be createdoh
Alternatively you can just do
dotnet new console -n "MyAppName"
and it'll create a new directory with that name and place the app inside thati arleady created a folder tho
can i just use that
Yeah you can run
dotnet new console -n "MyAppName" -o .
oh ye
sorry for all teh questions but what is a solution
So in C#, there's a thing called a project. A project is something like a console application, a WinForms application, a class library, etc., it's a collection of code which is grouped together to either be run or just exist by itself. When you use
dotnet new
, it creates a new project, a console application. A solution is just a collection of these projects, because sometimes you'll need to have multiple projects for different reasons.
A solution is only really useful with an IDE like Visual Studio, though.do i need one?
So you can think of it like this
A solution contains multiple projects > a project contains multiple files > a file contains classes (code)
i only need a single project
Not if you're using VSCode (which I assume you are)
i use fleet
oh fancy
yep
wanted to test it out
on jetbrains website it says to create a solution
I don't know a lot about Fleet, but I assume it doesn't recognize solution files, so it's probably unneeded
oh, if it mentions that then sure
So once you've created your project using
dotnet new
, navigate into the project directory, then run dotnet new sln
and dotnet sln add .
to create the solution file.okay ill see maybe i dont need it
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.