简体   繁体   中英

Visual Studio 2017 - how to change .NET version of existing project?

I just installed new VS and opened existing project.

It is showing error:

"The C# project "..." is targeting ".NETFramework,Version 4.7" which is not installed on this machine...

But I just installed new VS (November 2018) and pretty sure it comes with newer .NET.

What configuration settings I should change to make this work (open existing project with correct .NET version)?

Right click on project, Properties --> Application --> Target framework . Target framework dropdown displays list of frameworks installed on your machine.

It's not enough to install the latest version of Visual Studio; you need to ensure that you're actually installing the version of .NET Framework you want. It won't install all of them by default.

  1. Re-run your Visual Studio 2017 installer.
  2. It should detect that you already have Visual Studio 2017 installed, and click Modify.
  3. After that, click on the box that says .NET Desktop Development (note, don't uncheck the box -- simply click the box itself). On the right pane, you should see some optional components. If you see .NET Framework 4.7 development tools unchecked, that means it is currently not installed and you need to check that box and anything else additional that you need, and install it.

Conversely, you can also go to the Individual Components section and find the .NET Framework 4.7 SDK/Targeting Pack components and install them from there as well (they should be at the top of the list).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM