6

I started working on a project in Visual Studio 2012 professional, which has been written in Visual Studio 2010 SP1. In the solution is several projects. In one them is a problem, when I set it as the startup project I have the message: "There were build errors. Would you like to continue and run the last successful build?", but there is no errors in error list (others projects build success if them set as a startup). In the VS2010 there was no problem.

The only problem that I see is: in the Properties -> Settings, I get an error:

"Could not resolve mscorlib for target framework '. NETFramework, Version = v3.5'. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted."

Cyral
  • 13,999
  • 6
  • 50
  • 90
kkk
  • 61
  • 1
  • 2
  • Is .NET 3.5 installed on that machine? VS2012 probably installs 4.0 by default, I think. But if it's a legacy project which explicitly targets 3.5 then that version also needs to be installed. – David Jun 21 '13 at 13:55
  • You may find hte following useful http://traf-o-data.blogspot.co.uk/2010/10/mystery-of-mscorlib.html – Alec. Jun 21 '13 at 13:55
  • **4600** views, *3 question upvotes...* bah! Common people!! – Jeremy Thompson Apr 28 '15 at 14:03

5 Answers5

6

Close VS2012 and remove the (hidden) .suo file. Removing that file will solve the problem. Set "show hidden files" via Control Panel\Appearance and Personalization\Folder Options.

Gerard
  • 2,649
  • 1
  • 28
  • 46
5

This can happen for a number of reasons. To find out the problem, Open Visual Studio Command Prompt and build your project or solution using MSBuild.

MSBuild <YourProject>.csproj

or

MSBuild <YourSolution>.sln
gls123
  • 5,467
  • 2
  • 28
  • 28
  • Thanks, this was a life saver. The VS Command Prompt showed me passing an Object to a function expecting a String parameter was the problem. Surprised that VS Error list didn't show it, you would expect both to use the same underlying technology. – Jeremy Thompson Apr 28 '15 at 14:01
  • how to write the command, like ? like C:\> MsBuild myproject.sln or C:\>myfolder\myproject\MsBuild myproject.sln ? Unfortunately, none of it is working – Zaveed Abbasi Jul 24 '17 at 20:24
4

As the error is trying to tell you, you should install .Net 3.5 or change the project to target a version that you have installed.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
1

It seems like this has been a problem for others at times. See: Visual Studio 2010: Could not resolve mscorlib for target framework '.NETFramework,Version=v4.0'

It could be a different version or a problem with the path to that version.

Community
  • 1
  • 1
Mattiavelli
  • 888
  • 2
  • 9
  • 22
0

Check your project physical path , If is to long , Copy project to some root directory folder with very short name. And try to build your project.

BJ Patel
  • 6,148
  • 11
  • 47
  • 81