Target Framework does not change in Visual Studio 2010 - visual-studio-2010

When I change the target framework of any project in Visual Studio 2010 it does not actually change the System assembly references. For example if I target v2.0 and check the properties of System and System.Data I can see that they are still both v4.0. If i change the target to v3.5, System stays at v4.0 but System.Core changes to v3.5.
Because of this I am truly not targeting anything except v4.0.

There may be something strange in your install. I just created a WPF project, keeping the default settings, thus targeting .NET 4. Then, I switched to 3.5. VS asked to reload the project and then the targeted runtime of the references was v2 (correct) and their version was 3.5 (with an error that Microsoft.CSharp and System.Xaml were missing, which is understandable).
Then, I did the same for .NET 3 and 2 and got the same results: after reloading the project, the version of the referenced DLLs had changed were it made sense (System.Data is always v2.0).
When using the CLR v2, the vshost debug helper had its name changed to something like vshost-clrv2.

I've reinstalled Visual Studio several times and it hasn't solved anything. After uninstalling there is 10.0 stuff laying all over the place leading me to believe the uninstaller is also leaving what ever is causing this issue. I'm going to have to reinstall the OS to get the issue to go away.
I also wanted to link to my earlier post because this post has more information about how I originally discovered this issue, contains a link to the Microsoft Connect bug report I opened and links to several other users experiencing the same problem: Visual Studio 2010 Can no longer build .NET v3.5

Related

How do I fix missing NuGet references?

I'm using Visual Studio Professional 2017, version 15.6.6. A co-worker gave me a solution which he says I should be able to open and rebuild without any problems. There seems to be something wrong with either the NuGet packages and/or Framework. Co-worker will only say it must be something wrong with my computer, so I'm hoping someone here can help.
I tried right clicking on the solution and picking "Restore NuGet Packages". The references still have the yellow triangle by them. I tried to rebuild anyway and got the message "The reference assembilies for framework ".NETFramework, Version=v6.0" were not found. I looked at the project properties and saw the target framework was blank. I tried choosing .NET Framework 4.6, but that gave me multiple errors of the type "Package [name of NuGet package] is not compatible with net46(.NETFramework, Version=v4.6)." The co-worker had mentioned trying .NET Core before, so I tried downloading .NET Core 3.1 from this site: https://dotnet.microsoft.com/en-us/download/visual-studio-sdks?cid=getdotnetsdk. I installed it (including restarting my computer), but don't see .NET Core in the Target framework. Can anyone help guide me getting this solution running?
Here's an image showing the missing references (yellow triangle) on the right and the reference error message when I tried to rebuild.
Here's an image after I set the framework to 4.6 and showing the target framework choices I have available:
We can see that:
.NET 6 is supported by Visual Studio 2022 and Visual Studio 2022 for Mac (and later versions).
You can update to VS2022 and try again.

symbols, visual studio, versions, and symchk

I have a project in visual studio (c#) which is using .net 4.5, I arrived at a point where I need to debug the framework source to understand what's happening in a multithread deadlock.
I found http://referencesource.microsoft.com/netframework.aspx, where you can download the debug symbols, and I saw that there is a .net 4.5 update 1. Ok so I search on microsoft.com the update, install it, restart the pc, then install said debug symbols and configure visual studio for using them.
Problem: when I debug my project and try loading the symbols (like mscorlib), visual studio says that there are no matching symbols in the folder.
I saw this: How do you enable "Enable .NET Framework source stepping"?, in which it is said to disinstall the windows updates, but I have only installed KB2707250 (VS2012 update 1), KB2504637 (alters System.Net assembly), and KB2750149 (the .net 4.5 update 1) -- there are not other updates.
So the assemblies reported versions are v4.0.30319.18033 and v4.0.30319.17929, which from what I understand are v4.5 and v4.5 update 1 where it applies.
Fact is, I downloaded from referencesource.microsoft.com both debug symbols for .net 4.5 and .net 4.5 update 1, which, considering there are not any relevant updates on my system, should correspond to the installed frameworks.
But evidently it's so only for 5 of 18 referenced assemblies (project excluded).
How can I gather additional informations?
How can I make visual studio and the debug symbols work happily together?
In the end I can see the source, that's not complicated, but I don't know what values there are in fields and properties...
UPDATE:
I've been able to obtain the correct pdb ({3303BFEA-79E7-40C2-A2A8-34C1C816E082}), but still it lacks the source, so it's useless. Srctool doesn't seem to be useful either in this case.
Now the funny thing is: I have the source, AND I have the pdb, but it doesn't seem they can be used together. Don't know, maybe I'll think about recompiling mscorlib, if it's possible.
->No, apparently the answer is no.

Entity Framework Build Issue in VS 2012 .NET 4.5

Is there any trick/workaround/known "gotcha" regarding Entity Framework 4 and Visual Studio 2012?
I have a project that works and compiles perfectly on my Windows 7, VS 2010, .NET 4 box. Over the weekend I setup a new machine, with Windows 8 Enterprise RTM, and VS 2012 Ultimate RTM. EF design is out of the box, using ObjectContext approach (pre EF 4.1).
I retrieved the working solution from source control, went through conversion process, and get it to build successfully in VS2012 targeting the .NET 4 Framework.
However, when I run the app or debug it, I get "unable to load metadata resource" from the first EF call. Soo ..
Step 1: Work the EF error
Ok, so I use dotPeek to see the assembly, and sure enough when built in VS2012, the EDMX metadata files are not in the assembly.
Step 2: work the missing resources problem
I set metadata processing to "copy to output" and then back to "embed" to force. Nope.
I looked around the MSBUILD files for 4.5 to see if the EntityDeploy targets looked corrupt. Nope.
I did a full repair on VS 2012 to see if something got messed up. Nope.
Set MSBUILD VS version to "11.0" to avoid the 2010 compatibility checks in the csproj. Nope.
Step 3: Delete model, try again using VS 2012 defaults
Ok, I figured I just couldnt make this work. So I deleted the model, and readded as new in VS 2012, which uses EF 5.0 from NuGet, and recontructs using the DbContext approach. Got all this lined up, fixed a few syntax things b/t EF 4.0 and 5.0 and we are building.
Still get same error, still no resources in .DLL
A collegue of mine can build this successful in VS 2012 but on Windows 7 w/o .NET 4.5 installed.
Is there a bug or known issue in .NET 4.5 or MSBUILD 4.5? gotta be missing someting simple.
Figured it out. I don't have a .resources file in this project and it appears CoreCompile in .NET 4.5 is not embedding any of the EF resources files without that being present.
Trying to research is this is expected or new behavior.

Error registering package in Visual Studio 11

When I try to register a visual studio package using regpkg in Visual Studio 11 RC, I get the following error:
regpkg.exe /root:Software\Microsoft\VisualStudio\11.0 /codebase myvspackage.dll
Could not load file or assembly 'Microsoft.VisualStudio.Shell, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
system cannot find the file specified.
This worked fine with previous versions of Visual Studio. I'm working in a clean virtual machine that only has Visual Studio 2012 RC.
I've been surfing the web looking for a solution with no success.
If I just copy the Microsoft.VisualStudio.Shell.dll in my app location it works fine, but this dll is not redistributable, so... what's the right way of registering a package in Visual Studio 11?
Thanks in advance for your help,
Luis
I'll assume you also posted this to the MSDN forums since a question with identical text was posted there which I answered yesterday.
http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/96556cd4-44dd-4e01-8198-b83a66c6df26
In short it sounds like you have an explicit reference to v2 of Microsoft.VisualStudio.Shell.dll, James is incorrect in saying you aren't supposed to use this, this is simply MPF from 2005. Referencing it is perfectly fine. If you have an explicit version in the reference in the project file try dropping it, if not try adding the binding redirect mentioned in my MSDN forum post.
I have started a mail with the SDK team about this issue though I don't know if they will be taking any changes this close to release. Also, as an FYI, since Shell.dll is from 2005, it is nearing the end of its supported life, we generally support three versions of previous VS releases.
On release of 2012 the support will be 2008,2010, 2012. I suspect in the next release (after 2012) we may stop including Shell.dll (the 2005 version) entirely in the shipped product. Unless you need to run downlevel on say 2005 I would update the reference to one of the newer shell assemblies (like 9.0, 10.0 or 11.0)

The version of clr.dll in the target does not match the one mscordacwks.dll was built for

I am working in an ASP.NET MVC 3 application using the .NET framework 4.0. When I go to debug my application, i get the message:
"Unable to attach to application 'webdev.webserver....
The version of clr.dll in the target does not match the one mcordacwks.dll was built for.
Do you want to continue anyways?"
I have Windows 7, fully updated. I have repaired and uninstall/reinstall visual studio 2010 and repaired the .NET Framework 4. I am using VS 2010 ultimate. The application is ASP.NET, MVC, .NET 4, Linq to SQL, and ADO.NET entities, and TFS.
I have not changed anything in the project nor changed anything on my system. The only thing I have done is update my computer. I have tried creating a blank project and get the same message. I cannot debug unit tests either without crashing. I have no clue what is going on!
Just had this issue and simply restarting Visual Studio fixed it for me.
I have finally solved this!
It seemed to have happened after I updated my Windows 7. One of my files must have been out of date.
The fix: Install VS 2010 Service Pack 1:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=75568aa6-8107-475d-948a-ef22627e57a5
Worked correctly right after I installed. Hitting breakpoints and everything!

Resources