Mark
Mark

Reputation: 7818

Run webapi without installing .net4.5

I have a website running aspx pages, under asp.net4.0.

I also have some DevExpress controls, that I purchased 4 years ago.

I now want to add an API to the web application, however I understand that needs .net4.5 to be running.

The DevExpress controls don't work under 4.5 - so I would need to renew them at considerable cost.

  1. it possible, after installing .net4.5, for my site to continue to use .net4 - and not the new 4.5? so that I can have the site operate under 4.0, and the API under 4.5?
  2. Or is it possible to have the API (using the Entity Framework) run under .net 4.0

Thank you,

Mark

Upvotes: 3

Views: 5100

Answers (3)

EduLopez
EduLopez

Reputation: 719

You better recreate the web API project using final version of the WepAPI assembly

Tutorial: http://david.gardiner.net.au/2015/08/aspnet-web-api-for-net-framework-4-in.html

Upvotes: 0

Filip W
Filip W

Reputation: 27187

  1. Yes, if you put your Web API in a separate project, you can make it 4.5 and the other projects you have that make up the site can be 4.0. You choose which framework you target when you build your projects: Right click on project > Application > Target framework dropdown

  2. You can add Web API to any .NET application that uses at least .NET 4.0. Web API doesn't require .NET 4.5. It can be a Web Forms project, MVC project, empty project, console app, WPF app, Metro app etc etc - as long as .NET version is at least 4.0.

But the simplest solution in your case seems to be to just keep everything under 4.0.

Upvotes: 4

Eivind T
Eivind T

Reputation: 1059

You can use both web-api and entity framework without installing .net4.5.

You can add web-api to an existing project by installing the nuget package "Microsoft.AspNet.WebApi" (release candidate)

Upvotes: 4

Related Questions