Visual studio does not display .NET 4.0 (or 4.5) framework option for target framework
Introduction
Even if you have .NET framework 4.0 (or above) installed correctly, Visual Studio sometimes does not pick it up. This means that you will be unable to convert any of your projects to compile against 4.0 (by setting the ‘build target’ to 4.0 or above). Simply changing the ‘target platform’ setting in the web.config to 4.0 does not do anything. You actually need to go through Visual Studio’s –>Project Level –> Properties –> Build –> Target Framework (or Application—>TargetFramework) – and set it to the framework of choice. In my case, I DID NOT see 4.0 or 4.5 (in spite of having both of these frameworks installed on my machine).
MISSING Framework 4.0 and 4.5
First thing I learned was that Visual studio uses the following path to CHECK for these installed frameworks (it is the folder for referenced assemblies – referenced by VS, I am guessing):
C:\Program Files\Reference Assemblies\Microsoft\Framework\xxx
For each installed framework, there is a folder (v3.0, v3.5) as shown below containing the assemblies that VS needs for its tasks.
As you can see, v4.0 is missing. I had this issue on my computer – and re-installing the 4.0 framework did not address it.
This folder is needed only by Visual Studio, so I thought maybe reinstalling Visual Studio will do the trick. That did not work either.
When this folder goes missing, it seems impossible to bring it back by doing a re-install.
TWO Solutions
Solution 1 (Recommended)
Try downloading and installing Visual studio 2013 (from here). That will install all the required .NET frameworks correctly – in places where Visual Studio needs to look for them.
Solution 2 (may work)
Another solution that worked for me was to copy this folder (v4.0 folder from another machine that had the v4.0 folder) – into the Framework folder above. This seemed to make Visual Studio happy and I could now pick v4.0 for my ‘target framework’ for my VS projects.
Summary
Visual Studio’s inability to pick up the correct .NET framework seems to be an annoyance – and re-installing BOTH Visual Studio and the framework does not seem to help. What worked for me was installing the latest version of Visual Studio (2013). You can also try the folder copying trick for a time saving solution. Once I installed VS 2013, I was able to see the correct framework versions in my ‘build target’ dropdown.
I’m not sure if this is the complete answer. On my VS2015 installation, I can only see v3.0 and v3.5 in folder C:\Program Files\Reference Assemblies\Microsoft\Framework.
However, my apps can target v4 / 4.5 / 4.5.1 / 4.5.2 etc.
My problem is that with my app that is targeting 4.5.1, the referenced assemblies are all 4.0 (eg System.ServiceModel) and I can’t reference 4.5 assemblies that have new classes that I need
Great job, it worked!
The same thing happened to me. I had VS2010 Pro installed, then installed VS2015 community, then later uninstalled community, and I got what you describe.
Mine was missing FrameworkList.xml in C:\Program Files (x86)\Reference Assemblies\Microsoft\.NetFramework\v4.0\RedistList.
Install the .NET framework developer pack for the version you want.
https://www.microsoft.com/net/targeting
That does not work, as you can see in his write-up, he already did that. I have the same bug. I’ve uninstalled and re-installed the developer pack and the version still does not appear in visual studio or in the folder mentioned above.
which verser will be best for iis server, 3.5 or 4.5 .net server?