Use web api 2 in visual studio 2010 - visual-studio-2010

How can I use web api 2 in Visual Studio 2010.
Is there any way I can use web api 2 in VS 2010?
Can somebody please help or guide?

If you want to include Framework version 4, you can follow these steps. In Visual Studio 2010 to add a project of type ASP.NET MVC Web API we can:
1 - Have .NET Framework 4 & ASP.NET MVC 4 installed.
2 - Add a new project and select MVC 4
( on this screen there is no Web API template which is where many users may expect to see it )
3 - Select the Web API Template
You can see the answer here
But in your case, you need to install framework version 4.5. Each version of Visual Studio prior to Visual Studio 2010 is tied to a specific .NET framework. Visual Studio 2010 and beyond allow for targeting of prior framework versions but cannot be used for future releases. You must use Visual Studio 2012 in order to utilize .NET 4.5.
But one user has found a scenario where we can use framework version 4.5 in VS 2010, please see the answer of David Woodward here. If you can install VS 2012, it will be much easier since you don't need to download and install anything else.

Related

Can I work on MVC 4 using Visual Studio 15 Preview?

Can I work on old ASP.NET MVC 4 projects using Visual Studio 15 Preview? If so, would VS 15 update the project/project file?
I don't want to mess up my old projects by opening them in VS 15.
At least you cannot do so in Visual Studio 2017 RC, but Microsoft seems to indicate the RTM release will support MVC 4,
https://www.visualstudio.com/en-us/news/releasenotes/vs2017-relnotes
MVC 4 Projects are not supported
Issue:
Open MVC 4 project using Visual Studio 2017 RC prompts to Install
Missing Features - .NET Desktop Development, which is incorrect. Even
after you install the missing features, project does not load in
Solution Explorer and shows up as incompatible.
Workaround:
No workaround, support will be added in the future.
But you should consider seriously about upgrading to MVC 5, as Microsoft technical support team should requires that based on the support policies,
https://www.asp.net/support

How to target .Net Core from Visual Studio?

The answer here suggests to target .Net Core.
I've installed Visual Studio 2015 Community Edition and Mono Runtime. The list of target frameworks in visual studio looks this way (No .net core):
What should I do next?
Had the same problem.
My mistake was that I chose the template for
Windows -> Console Application instead of
Web -> Console Application
when I created the new project. From your screenshot it looks like you did the same.
Depends on what you need. In my case I found that in the latest update for VS 2015 there's the option of Class Library (Portable) more suitable.
A useful add-on to VS 2013 and 2015 is .NET Portability Analyzer to check your code:
https://visualstudiogallery.msdn.microsoft.com/1177943e-cfb7-4822-a8a6-e56c7905292b?SRC=VSIDE

ASP.Net 5 Beta 8 xproj cannot be opened

I just installed the new release of ASP.Net 5 beta 8. I ran DotNetVersionManager-x64.msi and then WebToolsExtensionsVS14.msi. I tried to open a simple app that worked in beta 7 and it won't load the project with a message
This project is incompatible with the current edition of Visual Studio:
Microsoft Visual Studio Community 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00079
I then tried to create a new ASP.Net 5 web project and got this:
The project file 'c:\users\myfolder\documents\visual studio 2015\Projects\WebApplication3\src\WebApplication3\WebApplication3.xproj' cannot be opened.
The project type is not supported by this installation.
I have uninstalled and reinstalled the DotNetVersionManager and WebToolsExtensionsVS14 with the same result.
Fixed it by doing this
Close VS, then delete the folder at %localappdata%\Microsoft\VisualStudio\14.0\ComponentModelCache and restart – Sayed Ibrahim Hashimi
Thank you #SayedIbrahimHashimi
The easiest way to get started building applications with ASP.NET 5 is to install the latest version of Visual Studio 2015 (including the free Community edition).
Install Visual Studio 2015
Be sure to specify that you want to include the Microsoft Web Developer Tools.
Install ASP.NET 5.
This will install the latest ASP.NET 5 runtime and tooling.
Enable the ASP.NET 5 command-line tools. Open a command-prompt and run:
dnvm upgrade
This will make the default .NET Execution Environment (DNX) active on the path.
On Windows 7 and Windows Server 2008 R2 you will also need to install the Visual C++ Redistributable for Visual Studio 2012 Update 4.
You are all set up and ready to write your first ASP.NET 5 application!
Reference...

Is it possible to downgrade from Visual Studio 2012 to Visual Studio 2010?

I have a wonderful solution in Visual Studio 2012 with a Web project using WebAPI and a supporting Web Service project for data using Entity Framework (EF) Code First. I was just told I need to see about using Visual Studio 2010.
Is there something I can do to work on this project in Visual Studio 2010?
As Henrick answers: you do not upgrade/downgrade VS installs, rather you install versions side by side.
You note two technologies that might be problematic:
EF Code First: this is supported from 4.1 (or was it 4.2?) which is supported against .NET 4.0 and VS2010. Providing your not using enum or geo/spatial data types (which require .NET 4.5) this should work, but you'll need to ensure you update to the EF5 NuGet package for .NET 4.
WebAPI: This is new in MVC4, which comes with VS2012, but is a separate install for .NET 4/VS2010.
Finally. While some project types with round trip between VS2012 and VS2010 SP1 (you need the service pack) it is not true for all project types. Details are on MSDN.
You can install Visual Studio 2010 separately and open the project and see. There is no danger in having version 2005, 2008, 2010 or 2012 of Visual Studio installed.

ASP.NET MVC 2 and VS 2010 Beta 2

I have a VPS and I would like to be able to run ASP.NET MVC 2 apps that were built in Visual Studio 2010 Beta 2.
Which ASP.NET MVC 2 do I need to install (is it Preview 2?) and where can I get the installer for it since all I can find are MVC 2 RC for VS 2008?
You can install Framework 3.5 SP1 on the server, and copy System.Web.Mvc.dll to the bin directory, then it will work. You can extract the DLL from the GAC of the machine you have Visual Studio 2010 on. (Perhaps you have some other references too, that you will need to copy).

Resources