Cannot Change Target Framework?

As @Lex Li has pointed out, VS project properties don't allow you to change the Target Framework, as the project actually targets more than one frameworks. If, however, you plan to target a single framework, you'll have to change the "TargetFrameworks" tag to "TargetFramework" and specify only one target framework. Then, VS will allow you to select it from Project properties page again.


The two nodes in the project file, TargetFramework and TargetFrameworks (plural) are the culprits. While it didn't help my project by putting net461;net462 into the latter, I tried renaming the nodes to TargetFramework and entered only net461.

The rename logically also gave me back the enabled combobox and that was what Jan was asking.

I changed it back to TargetFrameworks assuming that the other is now decprecated and resolved the "multiple net version"-error by removing the net462-reference and coded a little replacement. I compile but can only target one net-version.


A modern class library should use multiple target frameworks today, which means the options can only be set in project files right now,

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>netstandard1.4;net40;net45</TargetFrameworks>
  </PropertyGroup>

https://docs.microsoft.com/en-us/dotnet/standard/frameworks

Visual Studio does not yet have suitable UI elements to reflect the options, and that's why it is showed the way you saw.

Tags:

C#