Visual Studio 2010 in Visual Studio 2017 - c#

So i'm doing this project for my Computer Programming Class (That's due tomorrow) and i'm basically done with everything. Our school has Visual Studio 2010, and I have Visual Studio 2017. However, when I open it, it asks me to change to ".NET Framework 4.6.1" as my computer doesn't have ".Net Framework =v4.0". When I do, I can edit the program, but I can't debug/compile the program, as it outputs this error:
The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, instal the SDK or Targeting Pack for this framework version... Therefore your assembly may not be correctly trageted for the framework you intend.
However, when I tried to go online and install the v4.6.1, the installer said that I had already had a version of 4.6.1 or a more updated version on my computer. I don't understand why this is, and if there's another question like this it would be helpful if you could link it as a reply. Thanks.

The answer to your problem is directly in the error message. "To resolve this, instal the SDK or Targeting Pack for this framework version."
My advice: Download and install .NET 4.0 SDK on your computer.
You can try one of these links to get the SDK:
https://www.microsoft.com/en-us/download/details.aspx?id=8279
https://www.microsoft.com/en-us/download/details.aspx?id=8442
You can also try the multi-targeting pack.
https://www.microsoft.com/en-us/download/details.aspx?id=29052

Also, checkout:
You can use the setup verification tool to diagnose your .Net Framework here: .Net Framework Setup Verification Tool or Alternative Download.
Also check the .NET Framework Setup Verification Tool User’s Guide
If you do find problems with your .Net Framework, you can use the Repair Tool to fix it, it is designed to fix issues specifically concerning the .Net Framework as well as updates: Microsoft .NET Framework Repair Tool
Hope this will be useful, good luck.

For VS2017 to support .NET 4.0, you need to make sure you've installed the correct component:

Related

Install .Net Framework 4.5 Targeting Pack

please help.
I have installed quite a lot of framework and development pack. as you can see in the image.
unfortunately I want to access an ancient project. this project runs on .net framwork 4.5, and must not be upgraded.
I have visual studio 22 installed, but whenever i open the solution, i get the following error as seem in the image bellow.
At the moment I have succeeded in installing the target park for 4.5.2 but it is not helping.
I have tried to install the .net framework 4.5 runtime, but i get the error bellow.
Please help
With help of #JonasH and #Narish, I took time to study the documentation to understand what is happening.
Following an article referenced by #Narish, I made a copy of the v4.5.1 folder in the .NETFramework dir, which is still compatible with v4.5 and renamed it to v4.5
As of this moment, the legacy code and & still opens.

I do have .NET 4.6.2 but VS still complains about it

So I am trying to open one of my team's project and I think it is in .NET 4.6.2. and it gave me usual error of you do not have this framework version, do you want to install it?
So I went ahead and installed that version and also restarted my computer. After that even if I see in my Control panel that I have already installed .NET Framework 4.6.2 Visual studio continues to complain about not having that particular version of .NET
Any idea on how to address this issue?
You need the .NET 4.6.2 targeting pack, not just the runtime.
Download can download it here https://www.microsoft.com/en-us/download/details.aspx?id=53321

How do you add the 4.0 reference assemblies to your build server (so the compiler finds them)?

The issue comes up when you install Visual studio 2012 on a machine without Visual studio 2010 installed previously (I think). I want to target .net 4.0, while building on Visual Studio 2012. I already have set up the machine without VisualStudo 2010. I end up with messages like:
*Warning 2 The primary reference "blablaLibraryproject" could not be resolved because it was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0". blablaExecutableproject*
The answering post here(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?) says:
You can correct this, but you need to add the 4.0 reference assemblies to your build server (so the compiler finds them), and not
just rely on the .NET 4.5 versions.
So how does one "add the 4.0 reference assemblies to your build server (so the compiler finds them)"?
They are already present on the machine. Just change the Target Framework setting of the project from 4.5 to 4.0
The problem discussed in that linked question is a pretty common one for programmers that try to setup a build server without paying for the VS license. Which goes pretty far, but is missing an otherwise freely available component, the multi-targeting packs for the .NET Framework versions.
Which is penny-wise but pound-foolish. They then make a fatal mistake, they add reference assemblies from c:\windows\microsoft.net instead. Like it was done in framework versions prior to .NET 4.0. This causes horrible to diagnose runtime exceptions when the built product is ran on a machine that only has 4.0 installed. The asker of the question was pretty lucky, he got a relatively easy to diagnose one. That however can be a lot worse, getting pretty bizarre TypeLoadExceptions for common framework types.
You don't have this problem, you installed VS so you already got the multi-targeting packs. The 4.0 version is available in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0. Both MSBuild and VS know how to find it there without your help. Just change the project setting to tell them that you want to target 4.0
In addition to Hans' answer, here is another possible reason for this:
My build server had Visual Studio installed, however, my project targeted .NET 4.0.3 and that specific target framework was missing on my build server. Therefore it silently defaulted to .NET 4.5.
I fixed this by changing the target framework of my project to .NET 4.

Can't use task.delay feature

I want to use the Task.Delay feature to set a delay in my program. I read and found out it's only in .NET Framework 4.5+. So I went ahead and downloaded .NET Framework 4.5. Well I still can't use this bit of code.
I'm not sure why. Any thoughts? I'm new to this so sorry if this is a dumb question. I'm using Visual Studios 2010 Express C#. Thank you for any help offered! Much appreciated!
Visual Studio 2010 Express can only target .NET 4. Download the latest edition and you should be set.
This could be a variety of things, but it sounds like you need to target .NET 4.5. Simply downloading .NET 4.5 doesn't tell your particular application that is should target that framework. You'll need to right-click on your solution and click properties, and then choose .NET Framework 4.5 as your Target Framework.
Edit: Asik beat me to it and was correct, I didn't even think about that. Once you download the latest version, you'll still need to change your target framework.

Install (activate) .NET 3.0 Framework with an application in Vista

if i have an application that requires .net 3.0, what is the proper way to make an install file out of it, that will install the application and then install (activate) the .net 3.0? i tried publishing my project through visual studio 2008 (c#) which created the installer and the .net activator, but it didn't work properly on computers other than my own, when the .net 3.0 was not present.
i though i could bundle http://www.microsoft.com/downloads/details.aspx?FamilyID=10CC340B-F857-4A14-83F5-25634C3BF043&displaylang=en with the application, which would download and install .net 3.0 if needed. this could work ok on non-vista systems, but on vista, the redist package reports an error: you must use turn windows features on or off in the control panel to install or configure microsoft .net framework 3.0
The key is to install the .net framework if it is not there - regardless of the OS. Also, just go ahead and install the .Net 3.5 framework if you are going to install one of them.
Anyway, if you are using the built in installer that comes with Visual Studio, this is a real pain in the butt. You would be better off, and saner if you went with a different installer package. Install Shield, Wise, InstallAware will all do it for you. I believe you can also find better guidance on how to do this with Wix and NullSoft Installer.
http://www.improve.dk/blog/2007/06/10/creating-a-dotnet-bootstrapped-installer-using-nsis
How can I detect .NET 3.5 in WiX?
Windows Vista has already .NET Framework 3.0 installed.
Now if you wanted for example to have .NET Framework 3.5 installed you could create a Setup Project and then right click and go to View->Launch Conditions. There will be a .NET Framework launch condition where you can specify the required version of the framework and an URL to download from.
Here's a post about Launch Conditions in a Setup Project.

Categories