Adding the WCF Web API to a project

Warning: This post is based on a prerelease version of the WCF Web API


In my previous blog post I showed how to get started with the new WCF Web API but one thing I skipped is how to install and add it to your project first. So in post I am going to add that information.


The easiest way to get started is to use NuGet and add the WCF Web API package to your project. There are several different packages for the WCF Web API but  the one named WebApi.All is the easiest to get started with as it contains all relevant assemblies.



However when I try to add the package to a simple console application I get the following less than useful error message when the installation fails.

Install failed. Rolling back…
Error HRESULT E_FAIL has been returned from a call to a COM component.




The reason is that the WCF Web API tries to add a reference to some assemblies that are not available in the .NET 4 Client Profile so make sure to switch this to the full .NET 4 Framework and adding the package will work.



Fortunately this problem won’t occur when you use an ASP.NET project to add the package reference as they default to the full .NET Framework in the first place.





One thought on “Adding the WCF Web API to a project

Leave a Reply

Your email address will not be published. Required fields are marked *