Why can I not always change Target Framework in Visual Studio for Mac?

Viewed 5783

I just downloaded Visual Studio for Mac and for some reason in some projects I've made, I can change the target framework, but most of the time it's greyed out:

enter image description here

Does anyone know how to always be able to change the target framework?

2 Answers

It turns out I had used the wrong template when I was first creating the solution. I should have used this one:

enter image description here

When used, it allows me to select the proper Target Framework.

Currently Visual Studio for Mac, with a .NET Core project, will only allow you to select those .NET Core target frameworks which are installed on your local machine.

The current .NET Core SDK that is installed with the Visual Studio for Mac installer includes the runtimes for .NET Core 2.1 so only 2.1 is available in the project options for the target framework.

On my machine, for example, I have 2.1, 2.0, 1.1 and 1.0 installed so I can choose all versions in the project options.

enter image description here

The About dialog shows you what .NET Core SDKs are installed.

enter image description here

You can see more .NET Core SDK information in the main Preferences dialog, as shown below:

enter image description here The target frameworks available for .NET Framework projects has more options since Mono supports a wider range of framework versions.

Related