C
C#15mo ago
Ryan M

❔ What do I do before I write any code?

I am looking for a simple yet accurate explanation on what I am supposed to do here. Ive downloaded .NET, ive downloaded VisualStudioCode and ive installed the C# extention, what do I do next? I think I need something along the lines of a "cd" and I don't even know what that is... I'm just completely lost, someone please help. (pardon my spelling)
103 Replies
Pobiega
Pobiega15mo ago
Well, using Visual Studio instead of VS Code is highly recommend for new people If you are on windows, I highly urge you to do so
SWR
SWR15mo ago
I second what Pobiega said, Visual Studio will automate a lot of the build and config work for you that VS code will simply ever do. If you're just starting out, and you're own Windows, definitely consider Visual Studio over VS code. Could you give some details on your OS, @Ryan M?
Ryan M
Ryan MOP15mo ago
great advice God im so thankful for discord...🤣
Azrael
Azrael15mo ago
VS 2022, .NET SDK, ReSharper (optional but recommended) & a browser.
Ryan M
Ryan MOP15mo ago
um my OS?
Azrael
Azrael15mo ago
Your operating system, Windows 10 for example.
Pobiega
Pobiega15mo ago
Windows/Mac/Linux/Something else?
Ryan M
Ryan MOP15mo ago
Windows 11
Pobiega
Pobiega15mo ago
yeah then go for VS community 2022
Azrael
Azrael15mo ago
Oh okay, that's decent for .NET development.
Pobiega
Pobiega15mo ago
it will install everything else you need
Pobiega
Pobiega15mo ago
you dont need to install the SDK on its own, and you certainly dont need Brave
Ryan M
Ryan MOP15mo ago
wow great thanks a lot haha
Azrael
Azrael15mo ago
You need a browser unless you're God.
Pobiega
Pobiega15mo ago
Im sure Ryan has a browser or two already.
Azrael
Azrael15mo ago
Yes, Brave was just a recommendation. I'm not going to link all of the exisiting browsers.
Pobiega
Pobiega15mo ago
Lets not dump 3 links on the rookie when a single one would have sufficed.
Azrael
Azrael15mo ago
Does it matter though?
Ryan M
Ryan MOP15mo ago
one sec...
Pobiega
Pobiega15mo ago
Yeah it does, you're confusing a beginner by posting your recommended browser together with things they actually need
Azrael
Azrael15mo ago
How was that confusing though?
Ryan M
Ryan MOP15mo ago
ok so do I download Community, Pro, or Enterprise
Pobiega
Pobiega15mo ago
Community. the others are paid
Ryan M
Ryan MOP15mo ago
ok
Azrael
Azrael15mo ago
Community is good.
Ryan M
Ryan MOP15mo ago
got it
Pobiega
Pobiega15mo ago
and you dont need the features they unlock anyways to be honest community is very well featured
Azrael
Azrael15mo ago
I have Enterprise, but I've never used any of its features. I can't even tell the difference except for the little name tag in the top right corner.
Ryan M
Ryan MOP15mo ago
👍
SWR
SWR15mo ago
This is the only installation you'll need to choose too, for C#
mtreit
mtreit15mo ago
While I agree that you should likely start with Visual Studio as your IDE, if you've installed the SDK and want to take the nest basic step, I recommend using the CLI to create a simple hello world program and make sure everything is working. It's as simple as:
dotnet new console --name HelloWorld
cd HelloWorld
dotnet run
dotnet new console --name HelloWorld
cd HelloWorld
dotnet run
If that successfully prints Hello, World then you know everything is good to go. Now you can open the .csproj file tht was created in VS and start coding.
Ryan M
Ryan MOP15mo ago
that's great I just want to make sure if there's anything important I need to know at this step here:
Ryan M
Ryan MOP15mo ago
Azrael
Azrael15mo ago
Pobiega
Pobiega15mo ago
As SWR said, just the ".NET Desktop development" workload is needed
Ryan M
Ryan MOP15mo ago
right
Azrael
Azrael15mo ago
Depending on what you want to do, you might have to install other dependencies. But that one should do for now.
Pobiega
Pobiega15mo ago
yeah you can always come bakc and add more later
Azrael
Azrael15mo ago
For example, you need ASP.NET for ASP.NET.
mtreit
mtreit15mo ago
What kind of programs are you planning on building?
Ryan M
Ryan MOP15mo ago
ok so I click on that, and then ready to install?
Azrael
Azrael15mo ago
Yeah.
Ryan M
Ryan MOP15mo ago
coolcool
Azrael
Azrael15mo ago
If you want to create something else like a web application you can always come back and tick that one as well.
Ryan M
Ryan MOP15mo ago
um yeah, I got that just, can you give me an example of a web application? ... Sorry im kinda hooked on to yall here😆 ok never mind I got it I know what a web application is
mtreit
mtreit15mo ago
dotnet new webapi --name MyAwesomeWebApi
cd MyAwesomeWebApi
dotnet run
dotnet new webapi --name MyAwesomeWebApi
cd MyAwesomeWebApi
dotnet run
Then go to http://localhost:5063/swagger/index.html 🙂
Ryan M
Ryan MOP15mo ago
wat
Azrael
Azrael15mo ago
Just an example.
Ryan M
Ryan MOP15mo ago
oh ok got it yeah this installation is likely gonna take another 15-20 mins so we otta wait
Azrael
Azrael15mo ago
Yep.
Iron
Iron15mo ago
I agree with the first comments when i was new i lost my mind on visual studio Code . Visual studio is much better for new users.
Azrael
Azrael15mo ago
Agreed, VSC debugging is horrible.
reflectronic
reflectronic15mo ago
it takes two button presses to set up VS Code debugging. much less time than it is taking to install Visual Studio
Ryan M
Ryan MOP15mo ago
Hey guys, I, sorry I was out for a bit... Anyways, I think i've gotten everything setup, I copy and pasted this code: Console.WriteLine("Hello, World!"); dotnet new console --name HelloWorld cd HelloWorld dotnet run and I got this:
Ryan M
Ryan MOP15mo ago
Ryan M
Ryan MOP15mo ago
not sure what's missing here
mtreit
mtreit15mo ago
dotnet new console --name HelloWorld
cd HelloWorld
dotnet run
dotnet new console --name HelloWorld
cd HelloWorld
dotnet run
These are supposed to be commands you run from a command line terminal, not C# source code. That was to test that the SDK was working without using Visual Studio Like, from a PowerShell window
Ryan M
Ryan MOP15mo ago
how exactly can I find the command line terminal?
mtreit
mtreit15mo ago
Do you know how to use the command line at all?
Ryan M
Ryan MOP15mo ago
I don't even know what "the command line" is refering to I'm sorry🤣 (pardon my spelling)
SWR
SWR15mo ago
If you have Visual Studio installed, you do not need to use the command line Can you send a full screen shot?
Ryan M
Ryan MOP15mo ago
sure
Ryan M
Ryan MOP15mo ago
Ryan M
Ryan MOP15mo ago
its my first project on this account
mtreit
mtreit15mo ago
It's this thing. Easier to use than Visual Studio to get a project up and running, but if you aren't comfortable at all using a Command LIne Interface then maybe stick to Visual Studio.
Ryan M
Ryan MOP15mo ago
ok well I don't even know the difference seems like command line is just another interface to write code in
SWR
SWR15mo ago
remove lines 6-8
Ryan M
Ryan MOP15mo ago
ok
SWR
SWR15mo ago
In the menu, go to Build Then build (either Ctrl+B or F6)
Ryan M
Ryan MOP15mo ago
ok it says "build succeeded" at the bottum left how is the "build" fuction significant? why should I have done it this time? what did it do
SWR
SWR15mo ago
It actually builds your text source code into a runnable application
Ryan M
Ryan MOP15mo ago
oh
SWR
SWR15mo ago
In the menu, go to Debug, and choose Run and Debug, or Run without Debugging either is fine
Ryan M
Ryan MOP15mo ago
Ryan M
Ryan MOP15mo ago
Ok so it gave me this
SWR
SWR15mo ago
huzzah You did it You built and ran your first C# program
SWR
SWR15mo ago
Hopefully not your last. catlove
Ryan M
Ryan MOP15mo ago
yah
SWR
SWR15mo ago
Going forward, I strongly suggest this as your way of building programs in C#. Much more new-user-friendly than using command line
Ryan M
Ryan MOP15mo ago
right thanks just one more thing
Ryan M
Ryan MOP15mo ago
Ryan M
Ryan MOP15mo ago
canu tell me whats wrong with this?
SWR
SWR15mo ago
Lines 5-7 are not C# code
Ryan M
Ryan MOP15mo ago
o o
SWR
SWR15mo ago
They're commands you would put in a command line interpreter to build your C# program and run it If you do not understand it, that's fine, but it's another reason you should ignore it for now.
Ryan M
Ryan MOP15mo ago
ok
SWR
SWR15mo ago
I believe mtreit gave you those commands, not understanding your CLI experience. I recommend disregarding it for now.
Ryan M
Ryan MOP15mo ago
yeah so far, this is seeming much more complicated than python
SWR
SWR15mo ago
As you become more comfortable with programming, you can look into CLIs again It's an exchange
Ryan M
Ryan MOP15mo ago
ok for what
SWR
SWR15mo ago
I do C++, C#, and python heavily. They're all equally easy to build and debug (except C++) once you get used to it.
Ryan M
Ryan MOP15mo ago
ok then I'm super thankful I have access to this community, I can't thank all of it, so I'm gonna have to just say thank you for now
SWR
SWR15mo ago
all good happy to help When I started, discord didn't exist There was a lot more suffering
Ryan M
Ryan MOP15mo ago
yeah🤣
SWR
SWR15mo ago
Play with C# in visual studio for a while. I think you'll grow to like it. Reach out if you have any more questions. Feel free to ping (just don't overdo it)
Ryan M
Ryan MOP15mo ago
perhaps when I learn a good foundation... anyways, im gonna go watch some programming with mosh bye
Mayor McCheese
Mayor McCheese15mo ago
When I started stack overflow didn't exist 👴
SWR
SWR15mo ago
did time even exist back then?
Omnissiah
Omnissiah15mo ago
nor youtube did
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server