3

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?

Lex Li
  • 60,503
  • 9
  • 116
  • 147
Thom Blair III
  • 141
  • 1
  • 7
  • What other .NET SDKs do you have installed? – Dai Sep 19 '18 at 19:10
  • I only have Microsoft.NETCore.App (2.1.0), but for the code I'm writing, I need to have Target Framework 3.5. I looked on NuGet, but I didn't see a Target Framework 3.5 listed. – Thom Blair III Sep 19 '18 at 19:13
  • If it helps, in the Solutions where I can change the target framework, there aren't any .NET SDKs listed in the Dependencies. – Thom Blair III Sep 19 '18 at 19:34
  • You cannot target .NET Framework 3.5 using Visual Studio for Mac, only .NET Core, Xamarin and possibly Mono. Only Visual Studio for Windows can target the full-fat .NET Framework. – Dai Sep 19 '18 at 20:18

2 Answers2

1

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.

Community
  • 1
  • 1
Thom Blair III
  • 141
  • 1
  • 7
1

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.

Matt Ward
  • 47,057
  • 5
  • 93
  • 94