Missing System.Web in Console Application
I have been working on a project which involved building a class library and then consuming that class library in a console application. Pretty standard stuff. The problem was, when I added a reference to the class library in the console project it would act fine until I tried to compile. When I tried to compile, any code referencing the class library acted as though I was missing an assembly reference. I could not understand it. I tried adding and removing projects from the solution. I tried creating a test console project and using my class library there. Nothing.
My class library compiled on its own just fine which was odd because usually assembly reference errors are because the referenced project didn't compile. After creating a test class library with no content and using that in my console just fine, I narrowed it down to the class library. I got a hunch that it had something to do with my usage of the System.Web assembly. I thought that adding that assembly to the console project might fix things. When I opened up the add reference dialog I noticed that System.Web was nowhere to be found! At this point I knew the issue was that the console project did not have access to System.Web for some reason.
After a little Google searching I found out that by default console projects have their target framework set to .NET Framework 4 Client Profile. This framework is a subset of .NET 4 that is stripped down to make installer packages smaller and faster. I'm sure this is useful for most applications, but in my case I need everything. To fix it I simply right-clicked my console project and went to properties. The "Application" tab is selected by default and in there is an option called "Target framework". Simply set the target framework to ".NET Framework 4" and all is well again.
I really hate when simple issues like this take up so much time. Hopefully this saves someone in the future from running into similar issues.