unable to refer System.Threading.Volatile - visual-studio-2010

I've just installed final version of .NET Framework 4.5 and rebooted. I'm using VS 2010.
I've tried to use new System.Threading.Volatile class but I receive "Cannot resolve symbol" error when using System.Threading.Volatile.
In project properties target framework version is ".NET Framework 4" which I suppose includes 4.5
Why I can't refer System.Threading.Volatile and how to resolve my problem? Have I to use VS 2012 for that?

You can't use .NET 4.5 from Visual Studio 2010. You need to install VS 2012 to target .NET 4.5 and use new types defined only in 4.5.
In project properties target framework version is ".NET Framework 4" which I suppose includes 4.5
No, it does not. It only includes classes and types in .NET 4. You need to target ".NET Framework 4.5", which requires VS 2012.

Related

.NET 5 not available in Visual Studio 2019

I have downloaded and installed .NET Core 5.0 SDK (v5.0.100-preview.1) in my Visual Studio 2019.
But it is not available in Target framework.
Am I missing something?
You need to install the latest preview of Visual Studio 2019 16.8, refer to
https://devblogs.microsoft.com/aspnet/asp-net-core-updates-in-net-5-preview-1/
You also need to explicitly enable preview versions within Visual Studio itself:
Then you should see it:
Specs: VS Version 16.8.0
Target Version of .Net Core: 5.0
You must have version 16.8.0 in order to have .Net Core 5.0
If you still have problems with Visual Studio not showing .Net Core 5.0 in Visual Studio version 16.8.0 (and assuming you downloaded the .NET Core 5.0 SDK for Visual Studio), well, apparently (and correct me if I'm wrong) it is now called just .Net 5.0, omitting the Core.
After selecting .NET 5.0, I was able to install other libraries which are currently version 5.0+ and dependent on .NET Core 5.0+
Is the new name intentional? Anyways, here some evidence of this working (I was able to install the newest version of Newtonsoft and Entity Framework for .Net Core):
Funny enough, when I try to create a new .Net Core project, the version shows up as expected:
I upgraded my version of Visual studio from 16.7.x to 16.8.1. I expected NET 5 to be listed as a target framework, but it was not.
I had previously created projects in 16.8 preview 6 using RC1.
Visual Studio Install did not list .NET 5 as an individual component either. I then downloaded and installed the x64 SDK. Still no luck. .NET5 was still missing as a target framework for VS 16.8.x
Today I opened VS Installer and from the More dropdown menu selected Repair . The repair process took 25-30 minutes to run, but now .NET Core 3.1 and .NET 5 are listed in all the usual places.
Norm
Maybe a bit late to the party.
Please note that if you've selected a 'regular' .NET Framework application you won't see the .NET 5.0 Framework option.
This is only visible in .NET Core project styles.
Try to set it in your .csproj file. Right click (maybe unload) and edit (within a PropertyGroup-element):
<TargetFramework>net5.0</TargetFramework>
Targeting .NET 5 (rc2) doesn't work smoothly in VS Version 16.8.0 Preview 6.0
I could only target .NET 5 by manually changing the .csproj file, and adding:
<TargetFramework>net5.0</TargetFramework>
When I wanted to create a solution, .NET 5 was not available, even when I have it installed. What I did to fix this was:
When you are creating the project, select the last version (in my case .NET Core 3.1)
When the project is created, right click on the project and select the Properties option.
In the Application tab, select the Target Framework you want.

Cannot target .NET Framework 4.6.1

I try to load an existing project (not mine) that I get from TFS and I got an error telling me that I need .NET Framework 4.6.1 to load it.
So I downgraded it to 4.6, successfully load it, install .NET Framework 4.6.1 but I can't make my project target on 4.6.1.
The link where I get .NET framework
I'm on Windows 7 and I use Visual Studio Community 2017.
You may need to install the developer pack. It looks like you may have just installed the runtime. You can find the .NET Framework 4.6.1 developer pack here.

Installed Net Framework 4.5. Can build/target Framework 4.0?

I have installed Visual Studio 2012 Express, and .NET Framework 4.5 got installed together.
Now from Visual Studio 2012, also if I target .NET 4.0 (Properties->Application->Target Framework), that doesn't seem to work. (The same happens from Visual Studio 2010, which by the way cannot target 4.5 at all!).
What I have noticed is that if I debug my project, and set a Watch on a SqlConnection variable, I see all the new 4.5 member properties (for example I see SqlConnection.ClientConnectionId property, introduced with .NET 4.5).
So, what is Visual Studio -> Properties -> Application -> Target Framework -> 4.0 supposed to do?
This 'strange' behaviour looks, in fact, perfectly normal when you realize that the installation of .NET Framework 4.5 is a replacement of .NET 4.0.
Look at Stack Overflow answer Can a build server with .NET 4.5 installed successfully deploy a project targeting 4.0 to a server with only .NET 4.0 installed?.

Would like to install Entity Framework 5 with VS2012 but I'm lost

I installed Visual Studio 2012 and migrated a project from Visual Studio 2010 with Entity Framework 4.3 and .Net Framework 4.0
Now I would like to reference Entity Framework 5.0 and .Net 4.5
BUT when I go to the Manage Nuget Package window and search for EntityFramework. It says that Entity Framework 5 is already installed (there is no 'Install' button and I have a green check). This is strange because when I take a look in my explorer window for this project and get the properties of the reference 'EntityFramework' I see that this is the version 4.4.0.0. I agree that the path is told to be 5.0 but what? I don't understand anymore which version is installed.
Any help please?
Thanks :)
Remove EntityFramework package from your project, switch project to .NET 4.5 and add the package again. EF 4.4 and 5.0 represent "the same package" but the difference is the version of .NET they are targeting.

Using VS2005 assemblies in VS2010 projects

I have a number of assemblies which were built with VS2005 (.Net 2.0). I would like to reference them in a VS2010 project. Do they need to be rebuilt in VS2010 to execute in the .Net 4.0 framework or will they continue to execute in the .Net 2.0 Framework?
Your .NET 2.0 assemblies will continue to work fine when referenced from a .NET 4.0 project in Visual Studio 2010.
This assumes that you have both .NET 2.0 and .NET 4.0 frameworks installed on the machines where your application will run. (.NET 4.0 framework is brand new from the "ground up" whereas the like of .NET 3.0 and 3.5 were "additive").
By default, your pre-built assemblies will continue to reference the .NET 2.0 framework (i.e mscorlib.dll etc.) whilst your new Visual Studio 2010 will reference the .NET 4.0 framework versions. See the screen-grab from reflector below:
(VS2005Test is a class library built against .NET 2.0 in VS2005, and TestReferencingVS2005.exe is a console application built against .NET 4.0 in Visual Studio 2010)
Visual Studio 2010 also supports "multi-targeting" with projects at the source code level. This means that you can load the source for a project that was written in VS 2005 and targets the .NET 2.0 framework, and VS2010 will allow that project to continue to target the 2.0 framework. Of course, you can also upgrade it to use 4.0.
So, if you don't mind re-building, and it's not going to cause you problems, you can use Visual Studio 2010 have both your assemblies and final application all targeting .NET 2.0 or "upgrade" the assemblies to .NET 4.0 along with your application.

Resources