You want to learn web development using asp.net core. Maybe you’re on Windows, Mac, Ubuntu or some other Linux distro. You want to stick with what you know. You definitiely don’t want to switch OS just because you signed yourself up for a new stack.
But like your first day in high school, you’re wondering around a bit awkward. Let’s get you started.
First, some good news. Since .net core is 100% cross-platform (that means you can run it not only on Windows but also on Mac and Linux) you can stick with whatever OS works for you. And when I say “cross-platform” I’m not talking about some hacky, off-the-beaten-track way of getting .net core to play nice with your Mac or Linux box. No, I’m talking the sweet open-source, 100% Microsoft supported, first-class citizen kind off “cross-platform”.
When you’re developing web app’s on asp.net core you can rest assured that you won’t miss out on anything just because you want to work on Mac or Linux instead of Windows. It’s something we’ve been looking forward to for years. It’s glorious.
This is day 1: orientation. Let’s take a look at what you need to get started and how the parts fit together.
Coding and editing your app
You’ll need a code editor. Something not as simple as NotePad or TextEdit, but not to complicated either. Although Visual Studio (the behemoth of an IDE used by much of the .net developers) is a powerful tool, given the current state of .net core it’s by no means necessary. This is a win for you because this makes it easier to get started with .net core on Mac or Linux since the learning curve of Visual Studio is steep. If you’re still a bit new to software development or coming from another language like php, python, or ruby, chances are that you’re not used to a full fledged IDE, but rather prefer using a more simple code editor.
Your best bet at this point is Visual Studio Code. It’s an editor created by Microsoft so it’s got all the necessary bells and whistles for building a .net core web app, but it’s far from a complex IDE. It’s more like Sublime Text or Atom and developers have embraced it fully, most from outside of the .net world since it’s a general code editor that works with most languages and frameworks. It just happens to come out of Microsoft. You’ll feel right at home.
Don’t get thrown off by the name Visual Studio Code either. The full Visual Studio IDE is an entirely different beast. Visual Studio Code is more like it’s little, edgy cousin.
Once the download completes, install Visual Studio Code.
It’s good to know that the Visual Studio IDE also has a Mac edition which you can always scale up to later if you want to. But let’s not worry about that for now.
Building, running and interacting with your app
Your machine needs to know what to do with all that c# code that you’re about to wrestle in Visual Studio Code. Like most other languages c# and .net core require a runtime (or ‘engine’, or ‘distribution’, or ‘virtual machine’ - lets not get hung up on specifics right now) to execute.
Installing the required tools is a two-step process:
→ Download the latest version of .net core AND the asp.net core runtime. Once the download completes, install the runtime. Note that you need to download and install both the .net core and the asp.net core runtime separately! Check the table at the bottom of the page.
→ Download the latest version of the .net core SDK. Once the download completes, install the SDK.
The SDK contains some utilities and command-line tools to help you productively build .net core apps. It allows you to create new projects from templates, compile your code, etc. Whats the difference between a runtime and an SDK? Short answer: a runtime makes your code go vroom while an SDK makes YOU go vroom by giving you some important tools that are only needed by you, the developer. This also means that the .net core runtime needs to be installed on every machine that will be running your app. The SDK is not needed when just running your app.
To check if everything got properly installed, open your terminal and type the following command:
1 > dotnet --version
It should output something like this:
1 2 > dotnet --version 2.0.7
The exact version number could be different on your machine but should match the version you installed. If you see the version number in your terminal then all has been properly setup and you are ready to start building you first asp.net core web app.
You now have everything you need to start building web app’s on asp.net core. Your tools should be simple and do their job. I am confident that the above will put you on the right track. I understand that learning a new stack is never easy, and riddled with wrong turns and double bottoms. But stick with it! It’s more than worth the learning curve.
In the next article you’ll get started with Visual Studio Code and turn it into a mini asp.net core IDE. Be sure to sign up below for updates.