简体   繁体   中英

Visual Studio Community 2017 can't target .net framework 4.0, not listed on target page

I've got a relatively clean win10 box, with unity 5.6.2p2 installed. This also offers an installation of visual studio 2017 (v15.2).

When I try to open a solution targeting .net framework 4.0, I get a pop-up saying that 4.0 isn't installed. One option presented is to download the framework from https://www.microsoft.com/net/targeting?utm_source=getdotnetsdk&utm_medium=referral , but that site does not list the 4.0 framework.

What's going on? I could update the solution to 4.5 or later, but is there a way to get 4.0 installed and running?

I think the answer was that unity 5.6.2p2 makes a bad install of visual studio 17, or maybe it depends on some previous version of visual studio that I didn't have because it was a clean box.

I eventually got a working version of vs, and I think it was roughly this route:

  • on opening the solution, ask to upgrade to the suggested version of .net framework, which was I think 4.6.1
  • however that said I needed to install .net winforms or something. I accepted the download but it looked like it was going to take an hour on my connection so I cancelled it.
  • visual studio wouldn't then open, and directed me to the vs installer application
  • the installer application offered to repair my vs17, which I allowed it to
  • having reverted the changes VS had attempted to make to my solution, it would now open with no complaints. everything seems fine!

Just got this problem after upgrading Visual Studio 2017 Community a while ago

I solve this by re-enable it from: Tools -> Get Tools and Features

Then in the VS installation form, go to "Individual components" Check ".NET Framework 4 Targeting Pack" options and you should be fine.

XP must die, but the fact is it's still used by many old small company. Targeting .net 4.0 is much simple than you have to reinstall the whole windows. Its pain to find the old drivers .

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