{"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."} - by RealAzamSharp

Status : 

  Not Reproducible<br /><br />
		The product team could not reproduce this item with the description and steps provided.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


9
0
Sign in
to vote
ID 542789 Comments
Status Closed Workarounds
Type Bug Repros 11
Opened 3/17/2010 8:43:23 PM
Access Restriction Public

Description

When I start the web application without debugging the whole VS 2010 crashes and closes the application. 
Sign in to post a comment.
Posted by skparmar on 12/7/2011 at 1:16 PM
This Answer is helpful to me. i edited .proj file and removed all Imports which was referring to Service Reference and problems got resolved. I was getting mscorlib.dll error with Silverlight 4 framework
Posted by chuckeng on 8/22/2011 at 2:40 PM
@Avinash.Tiwari007
This is a good point that can easily be overlooked. :)
Posted by chuckeng on 8/22/2011 at 2:40 PM
@Arthur Gardner
Perhaps you are using upgraded projects, and that has caused an issue. Try creating a brand new project and then add your assets (source files, images, etc.) to it.
If this still does not solve the problem, then please file a new connect bug. This one is in an old database, and I am responding only by shear luck. :)
Posted by chuckeng on 8/22/2011 at 2:39 PM
@Fate1990
Make sure that the you are targeting a framework that is installed on your machine.
Based on your comments, the only thing you have not changed is the project itself. Try creating a brand new project and then add your assets (source files, images, etc.) to it.
If this still does not solve the problem, then please file a new connect bug. This one is in an old database, and I am responding only by shear luck. :)
Posted by chuckeng on 8/22/2011 at 2:36 PM
@The_Assimilator
You can adjust the framework you are targeting by going to the project properties. Right click on the project node, and click properties. Select the Application tab, at the top (if not already selected). The "Target Framework" sets the framework you are targeting. By default, a new project you create in VS 2010 targets the ".NET Framework 4.0 Client Profile". If you are using things that are not available in the client profile (a subset of the full .NET framework to reduce framework download time and install size), then you must retarget to the full framework (".NET Framework 4"). Doing this is the same as removing the TargetFrameworkProfile from the project.
Posted by PhilipNunn on 6/23/2011 at 8:09 AM
I hit this issue and after lengthy troubleshooting, it seems to have been the PIA reference to stdole (my app still has some COM interop references). Because the references section of the project properties was giving me the "could not resolve mscorlib ..." error, I went to the offending project in solution explorer, selected Show All Files, and then expanded the References node to work with them there. First, I deleted all of the references with errors next to them. This solved the error in the References section of project properties. But then when I added some of them back, they added but gave the error "the system cannot find the reference specified" in the path column, even though I just selected it from a list of valid references! I then noticed that I had two references to stdole and that one was set to "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Common\stdole.dll". So I deleted both references and added one back again as a COM reference (shown in the list as "OLE Automation"). This seemed to magically fix the other references that were not resolving and all was well.
Posted by Avinash.Tiwari007 on 4/21/2011 at 9:08 AM
At last Keeping Path to my Solution below 256 character Solved The problem .

http://wcfvs.blogspot.com/2011/04/could-not-resolve-mscorlib-for-target.html
Posted by Arthur Gardner on 3/8/2011 at 11:23 AM
I get the same message, for some projects not for others. None of the projects has the TargetFrameworkProfile tag in its vbproj file. These are VB projects, VS 2010 10.0.30319.1 RTMRel, .NET 4.0.30319 RTMRel, Windows XP SP3. The projects were created from VB6 using ArtinSoft VBUC.
Posted by Fate1990 on 11/13/2010 at 1:38 PM
I have still this problem, i have re-installed whole windows 7 and then installed visual studio 2010 again. When i try to work with the entity framework, I still get the same exception. I have tried to remove the <TargetFrameworkProfile> tag but i can't find it in my .csproj. Please help me out.

Thanks.
Posted by The_Assimilator on 11/5/2010 at 9:26 AM
@ Harry Harrison

Try deleting the <TargetFrameworkProfile /> element, I found this makes the error go away.

Note: in my case this element looked like:

<TargetFrameworkProfile>
</TargetFrameworkProfile>
Posted by Microsoft on 6/29/2010 at 8:26 AM
We have not heard back from you and are in the process of trying to close open tickets.

It appears that the information we sent you may have resolved your issue.

If you feel that this issue has been closed in error, please re-activate this issue and provide additional information that will allow us to reproduce the issue in our labs.

Thanks,

Chuck England
Visual Studio
Program Manager - MSBuild
Posted by Microsoft on 6/21/2010 at 1:06 PM
Thanks for taking the time to send us this issue.

We do need a dump in order to debug the issue. However, looking at the stack trace provided, it appears that the target framework moniker (in this user's case) was correct and pointing to the v3.5 .NET Framework. This would lead me to believe one of three things is going on. They are:
1) .NET v3.5 is not installed; v4.0 is trying to build v3.5
2) You installed a previous version of Visual Studio 2010 (such as the Beta or RC) and the .NET Framework directories were not cleaned up.
3) There is a special registry key set which keeps v3.5 from resolving.

Number (1) may seem obvious, but since Visual Studio 2010 does not install v3.5, if you had older projects that you brought over onto a clean box (XP) and only installed Visual Studio 2010 on it, you may have this problem. To fix this, you need to install the v3.5 SP1 Framework.

For number (2), look in your Framework folder (and Framework64 on an x64 box with an x64 O/S) and see if you have more than one version of the v4.0 Framework. The correct RTM version is v4.0.30319. If you have other versions, you will need to remove these folders (they are most likley empty) and then most likely, you will need to run the .NET 4.0 Full Framework installer in the Repair mode.

For number (3), the only way to get here is by having added the key to your registry. (or it is in your environment) The key is OnlyUseLatestCLR, and has been cited in several articles on the internet recently. Setting this key is not recommended and will break many things, including multi-targeting builds as seen here.

Would you please check the list above, and if these items do not resolve your issue, create a detailed diagnostic log and attach it to the bug. To generate a diagnostic log, you can run MSBuild from a Visual Studio Command Prompt (found under Visual Studio in the start menu) by executing a command that looks similar to:
msbuild Project.csproj /v:diag /fl /t:rebuild
(where Project.csproj is the project or solution that has this issue)

An msbuild.log file will be generated containing the diagnostic log. It may be quite large.

Thanks,

Chuck England
Visual Studio
Program Manager - MSBuild
Posted by Microsoft on 6/21/2010 at 1:06 PM
Thanks for taking the time to send us this issue.

We do need a dump in order to debug the issue. However, looking at the stack trace provided, it appears that the target framework moniker (in this user's case) was correct and pointing to the v3.5 .NET Framework. This would lead me to believe one of three things is going on. They are:
1) .NET v3.5 is not installed; v4.0 is trying to build v3.5
2) You installed a previous version of Visual Studio 2010 (such as the Beta or RC) and the .NET Framework directories were not cleaned up.
3) There is a special registry key set which keeps v3.5 from resolving.

Number (1) may seem obvious, but since Visual Studio 2010 does not install v3.5, if you had older projects that you brought over onto a clean box (XP) and only installed Visual Studio 2010 on it, you may have this problem. To fix this, you need to install the v3.5 SP1 Framework.

For number (2), look in your Framework folder (and Framework64 on an x64 box with an x64 O/S) and see if you have more than one version of the v4.0 Framework. The correct RTM version is v4.0.30319. If you have other versions, you will need to remove these folders (they are most likley empty) and then most likely, you will need to run the .NET 4.0 Full Framework installer in the Repair mode.

For number (3), the only way to get here is by having added the key to your registry. (or it is in your environment) The key is OnlyUseLatestCLR, and has been cited in several articles on the internet recently. Setting this key is not recommended and will break many things, including multi-targeting builds as seen here.

Would you please check the list above, and if these items do not resolve your issue, create a detailed diagnostic log and attach it to the bug. To generate a diagnostic log, you can run MSBuild from a Visual Studio Command Prompt (found under Visual Studio in the start menu) by executing a command that looks similar to:
msbuild Project.csproj /v:diag /fl /t:rebuild
(where Project.csproj is the project or solution that has this issue)

An msbuild.log file will be generated containing the diagnostic log. It may be quite large.

Thanks,

Chuck England
Visual Studio
Program Manager - MSBuild
Posted by Oleg Ilyin on 5/24/2010 at 1:12 PM
Getting pretty much the same error when trying to build project containing edmx files one for each file.
Here is the details:
System.InvalidOperationException was unhandled
Message=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.
Source=Microsoft.VisualStudio.Shell.Design
StackTrace:
     at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse..ctor(IDesignTimeAssemblyLoader assemblyLoader, IVsFrameworkMultiTargeting globalAssemblyResolution, String targetMoniker, IVsSmartOpenScope dispenser)
     at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkUniverse.GetUniverse(IDesignTimeAssemblyLoader assemblyLoader, IVsFrameworkMultiTargeting globalAssemblyResolution, String targetMoniker, IVsSmartOpenScope dispenser)
     at Microsoft.VisualStudio.Shell.Design.VsTargetFrameworkProvider..ctor(IVsFrameworkMultiTargeting targetInfo, IDesignTimeAssemblyLoader assemblyLoader, String targetMoniker, TypeDescriptionProvider parentProvider, IVsSmartOpenScope openScope)
     at Microsoft.Data.Entity.Design.VisualStudio.EdmUtils.GetEntityFrameworkVersion(Project project, IServiceProvider serviceProvider)
     at Microsoft.Data.Entity.Design.VisualStudio.Model.VSArtifact.get_SchemaVersion()
     at Microsoft.Data.Entity.Design.Model.Entity.ConceptualEntitySet.GetterAccessDefaultableValue..ctor(EFElement parent)
     at Microsoft.Data.Entity.Design.Model.Entity.ConceptualEntitySet.<get_Children>d__6.MoveNext()
     at Microsoft.Data.Entity.Design.Model.EFContainer.Dispose(Boolean disposing)
     at Microsoft.Data.Entity.Design.Model.EFNormalizableItem.Dispose(Boolean disposing)
     at Microsoft.Data.Entity.Design.Model.EFObject.Dispose()
     at Microsoft.Data.Entity.Design.Model.EFContainer.Dispose(Boolean disposing)
     at Microsoft.Data.Entity.Design.Model.EFNormalizableItem.Dispose(Boolean disposing)
     at Microsoft.Data.Entity.Design.Model.EFObject.Dispose()
     at Microsoft.Data.Entity.Design.Model.EFContainer.Dispose(Boolean disposing)
     at Microsoft.Data.Entity.Design.Model.EFNormalizableItem.Dispose(Boolean disposing)
     at Microsoft.Data.Entity.Design.Model.EFObject.Dispose()
     at Microsoft.Data.Entity.Design.Model.EntityDesignArtifact.Dispose(Boolean disposing)
     at Microsoft.Data.Entity.Design.VisualStudio.Model.VSArtifact.Dispose(Boolean disposing)
     at Microsoft.Data.Entity.Design.Model.EFObject.Dispose()
     at Microsoft.Data.Entity.Design.Model.ModelManager.Dispose(Boolean disposing)
     at Microsoft.Data.Entity.Design.VisualStudio.VisualStudioEdmxValidator.Finalize()
InnerException:
Posted by sladerz on 5/21/2010 at 9:28 AM
I get this exact error when just tryong to access the defaultTemplate.xaml file for Teambuild 2010. Has anyone found out anything on this one yet?
Posted by Ivan Eryshov on 5/5/2010 at 3:04 PM
I'm having the same issue with the release version of VS 2010.
Do you guys still needed mini dump? If so, let me know.
Posted by Harry F. Harrison on 4/20/2010 at 2:25 PM
I get almost the same exact error.

An error occurred trying to load the page.
Could not resolve mscorlib for target framework '.NETFramework,Version=4.0'. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted.

I get it on the References Page of the project properties AFTER I change the target framework of the project from 2 to 4. It is a small VB Forms project (10 or so files) have only one project in the solution - converted from VS 2003 to 2010.

I check the diffs on the .vbproj file before and after I change the target framework, and I see only changes in a few places.

In the <PropertyGroup> node - 2 changes

From
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
To
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

new line
<TargetFrameworkProfile />

new node
<ItemGroup>
    <None Include="app.config" />
</ItemGroup>

Simply undo-ing the first change with notepad and reloading the project makes the References page display, but that does me no good.

What is strange is that I have other converted projects (class library) that are set to target Framework v4.0, and I can show the references page with those projects.
Posted by SandRock on 4/10/2010 at 8:47 AM
Hello,

I have the same error message here when I try to create an ADO.NET Entity Data Model (targetting fx 3.5 or 4.0).
In the project properties, I also can't choose a target framework, the combobox is empty.

On another computer, I can't open any projet properties, there is the same error message (not in a MessageBox, it's replacing the properties panel). A VS restart fix the problem in this case.
Posted by Microsoft on 3/18/2010 at 7:50 PM
Thanks for reporting the issue.
Could you please provide us with a mini dump and call stack file? You can get detailed steps about how to get the dump file at http://blogs.msdn.com/kirillosenkov/archive/2008/12/07/how-to-debug-crashes-and-hangs.aspx

It would be greatly appreciated if you could provide us with that information as quickly as possible. If we do not hear back from you within 7 days, we will close this issue.

Thank you,
Visual Studio Product Team.
Posted by Microsoft on 3/18/2010 at 7:49 PM
Thanks for reporting the issue.
Could you please provide us with a mini dump and call stack file? You can get detailed steps about how to get the dump file at http://blogs.msdn.com/kirillosenkov/archive/2008/12/07/how-to-debug-crashes-and-hangs.aspx

It would be greatly appreciated if you could provide us with that information as quickly as possible. If we do not hear back from you within 7 days, we will close this issue.

Thank you,
Visual Studio Product Team.