Get Started with .NET Core 2.0

by 

| August 21, 2017 | in

.NET Core 2.0 is finally out, which finally closes the loop and create a very usable .NET Core. This quick blog post is a quick start for .NET Core 2.0.

1. Install VS Code.

2. Install .NET Core 2.0.

3. Fire up terminal.

4. Create a new solution.

5. Create a console application.

6. Add project to the solution.

7. Fire up VS Code and open the folder. You will probably get a warning about adding a build task. Go ahead and click “Yes”.

8. Now let’s run this application. Click the Start Debugging green triangle.

9. You should see in the output window a nice “Hello World” message. Let’s change it so we can say “Hello” and take a command argument and spit it to the console so we can display something like “Hello bob”. To accomplish this, we will make a small tweak to the code.

10. Let’s start by editing the launch.json file. We need to change the args from just an empty array to an array with “bob” in it.

11. Now run it again you should see “Hello bob”. You could also run from the console using “dotnet run -p hello/hello.csproj bob”.

Now you might be wondering, while console apps are great in all, what about web apps? Let’s stand up a web app really quick in that same solution.

1. Create an MVC project.

2. Add MVC project to our solution.

3. Update the build configuration.

4. Update the launch configuration.

5. Now run the application, you will have a web app at http://localhost:5000.

6. Remember, we are trying to be friendly and say “hi” to the user. So let’s make a small change.

7. Let’s make a small change to our home controller.

8. Then a tweak to the index.cshtml page.

9. Now we have a webpage that can say hi: http://localhost:5000?name=bob


Related posts