edo101
edo101

Reputation: 639

How to Pick which Framework Version to Build app for C# Visualstudio

I am very new to C# development. Like Youtube tutorial new. I am trying to build a console app to install services to our servers. Is there a way to pick which .Net version you want to use to build the application? So that I the writer can tell the user which .Net version they should have in their system for the console app to run?

I am using Visual Studio 2019

Upvotes: 0

Views: 1668

Answers (2)

Alen Smith
Alen Smith

Reputation: 1512

You have 2 options to get started

.NET Framework - Apps build using .NET framework can only run on Windows. This is an years old proven and secure stable, mature eco system

.NET Core - Apps build using .NET Core can run on Windows, Linux and Mac. It's cross platform and open source. Latest is v5.0.

I recommend you to use the latest .NET Core v5 for your new projects. It's stable and Microsoft is well supporting it. .NET Core much is powerful, faster and optimized.

You can create different kinds of apps using .NET Core. You can create simple console apps, libraries or asp.net core web apps. MVC and WebAPI are supported. As you mentioned, if you want to create a service, There is "Worker Service" project available for .NET Core. If you create a Worker Service it can run as a Windows Service in Windows machines and a Linux Deamon in Linux machines.

Visual Studio 2019 got well with .NET Core and it's features.

If you need to run a .NET Core project in Windows, Linux or Mac machine, you also need to setup the deployment machine installed with .NET Core runtime. It's available free from Microsoft website. Download.. Install.. Run. That simple

Upvotes: 0

edo101
edo101

Reputation: 639

Thanks to @David Browne's comment under my original post all you need to do is make sure to select .Net Framework version of the Console Application template in Visual Studio project template. Not .Net Core. I wasn't aware there was a difference:

"You set the Target Framework in the Project Properties. But the Project Type determines whether you're targeting .NET Framework or .NET Core"

Upvotes: 1

Related Questions