We are currently migrating all our solutions from 2005 to 2010 (that's right, we're skipping 2008!). We are also changing our file structure to make some more sense (some common projects would be nested within specific projects etc etc).
This all means references need to be changed! Apart from that we are also setting them all to .NET 4.0. To accomplish this we've made a temp "GOD" solution with all 117 projects in the same solution.
I am doing this with one co-worker and until about 2 hours ago everything was going according to plan. However we ran into a problem with one of the 117 projects. This project refuses to "display" it's references, resources, services, and settings tabs within the Project Properties.
I get the following exact message:
Could not resolve mscorlib for target framework '.NETFramework,Version=v4.0'. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted.
Now this is annoying but it gets worse. My co-worker, when getting the same solution from subversion, CAN actually see and change the references and things. As a matter of fact, currently the project actually BUILDS on his machine. He committed the changes but I can't build this specific project, or see the references.
Which leads me to the simple conclusion, something has to be different on my client which is causing trouble! Suggestions online that I've seen are the following:
- Multiple .NET4.0 versions installed (this is not the case on my client)
- .NET v3.5 is not installed; v4.0 is trying to build v3.5 (3.5 is installed on my client)
- The registery key: OnlyUseLatestCLR is set and is screwing things up! (scanned my registry, this key is not present anywhere!)
See: http://connect.microsoft.com/VisualStudio/feedback/details/542789/
The only thing I haven't tried yet which I could do is repair .NET 4.0 how ever I highly doubt this is the issue since we have about 100 other projects which I can edit and build just fine. Both C# and VB.NET.
for me, just setting Target Framework 4.0 resolved my problem. Sometimes the target framework is clear somehow. That might cause problem.
It could be that the path to your solution is too long:
http://wcfvs.blogspot.com/2011/04/could-not-resolve-mscorlib-for-target.html
I found this thread when I had the same issue but had no reference issues. I found the link above and it solved my problem. Hopefully this will help someone else who comes here with the same problem.
I was getting this error Warning just this morning. I just went Rebuild Project, I then closed Visual Studio, re-opened it and the error was gone.
i worked on my project saved the work and closed visual studio 2010. when opened again for working i got this error i just closed visual studio again copied the file where my project was saved and i pasted it somwhere else (in a file on my desktop) and i opened again the project with VS2010 and it was working.
I got this error too. ("Could not resolve mscorlib for target framework '.NetFramework 4.5.1'. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted.").
This happened when I changed the framework from 3.5 to 4.5.1 on a VB 2013 project. The solution was to remove all the references on the .vbproj file: all the references labeled Reference and COMReference groups.
Of course just after doing this all kind of other errors appeared on the project.
Then I started to copy them back, one by one in the same place, copying from a back-up in order to identify which between them were the problematic ones (I copied the ones related with the new errors I got in order to fix them), refreshing the project each time until the affected window visualized properly.
It resulted they were some customized libraries references which created this problem. I hope this could help someone. Cheers!
A Developer.
I was migrating a vb.net project to VS 2015. I also had the same issue. The problem is not with the .Net framework, since I was able to create a new Project targeting the specific Framework Versions and it succeeded.
In my case, the project was referencing FPSpreadADO and some other similar libraries. It worked fine once I removed those references.