5
votes

Things are moving so fast nowadays that it's hard for tutorials and blog posts to keep up.

It also doesn't help when your products have extremely similar names.

Since Visual Studio 2019 came out a few days ago I want to try to make a simple console application on .NET Core 3 (not ASP.NET Core).

I installed .NET Core SDK 3.0.100-preview3-010431 from here. However I am having trouble actually creating a project from inside the new VS or by editing the .csproj file, as my application crashes if I do the latter.

What would be the process to either:


1. Create a .NET Core 3 console application
OR
2. Create a .NET Core 3 console application with Visual Studio 2019 Community

1
Have you enabled Use previews of the .NET Core SDK in Tools > Options > Projects and Solutions > .NET Core (and restarted VS2019)? .NET Core 3 should appear in your project properties. The target framework will be netcoreapp3.0.Scott
@Scott, I have enabled the option, but I think the whole project window got a revamp in 2019 and it doesn't show an option to create a .NET Core 3 project. However I fixed my issue by correcting the version from netcoreapp3.0.100 to netcoreapp3.0. Would you like to post your comment as an answer?J. Doe
@Scott, sort of unrelated but what would be the OutputType for a .NET Core 3 Unit Test project? I.e. how to make a .NET Core 3 Unit Test project? :)J. Doe

1 Answers

5
votes

The simplest way to create a .NET Core console app is from the command line. Navigate to your code folder, and then (assuming your app is named MyApp):

md MyApp
cd MyApp
dotnet new sln
md MyApp
cd MyApp  [now you are in MyApp\MyApp]
dotnet new console
cd ..
dotnet sln add MyApp

This gives you a solution file, MyApp.sln, and a folder MyApp containing MyApp.csproj, which is part of the MyApp solution. Now you can open the solution with Visual Studio 2019 and start coding.

If this doesn't use the right .NET Core version, then from within your root MyApp folder, run

dotnet --version

and see what it says.