There's no way inside of Visual Studio to convert a web application project to a class library.
However, this is pretty easy done using your favourite text editor of choice by editing the .csproj-file changing two lines.
If you're not totally confident with what you're about to do, make sure you start with making a backup!
- Open your project file (.csproj)
- Locate <projectguid> and make a small change to the GUID.
- Locate <projecttypeguids> and delete completely.
- Save and reload project in Visual Studio. It should load as a class library this time.
Solution originally found here.