How to determine if we are using Web API 1 or Web API 2?

Introduce problem

I would like to know if we use Web API 1 or 2. My own packages.config file indicates version 5.0.0. Is this a web API 1 or 2?

Search and research

I tried googling the following:

"web api 1" "web api 2"

and

ASP.NET Web API Release History

and

ASP.NET Web API nuget

The best links are apparently these two nuget pages:

It is right? How do I know for sure?

+53
asp.net-web-api version
May 6 '14 at 18:42
source share
3 answers

I think what you found seems correct. I had the same question, after which I looked under my installed packages when you go to β€œManage Nuget Packages”. An item named "Microsoft ASP.NET WEB API 2.2" was installed. Therefore, I was able to determine my version.

+24
18 Sep '14 at 12:59 on
source share

I'm not sure what @John meant with the package name above. I have the following package right now:

Microsoft.AspNet.WebApi.5.2.3 

Based on this article http://www.asp.net/web-api/overview/releases/whats-new-in-aspnet-web-api-22 , I assume that starting with package version 5.2.2 this is a version of the Web API 2.2

+13
Sep 09 '15 at 20:23
source share

I always try this instead -

In the controller, make a method

 public IHttpActionResult MyResult(){ return Ok(); } 

If you get a compilation error, then this is API 1.0.

If there is no compilation error, you are referring to API 2.0.

+7
Jun 27 '15 at 13:55
source share



All Articles