SPSite site = new SPSite(http://dev/)
It throws an error:
"The Web application at could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application."
We would developing normally thinking that VS 2010 Console Application project template would have taken care of everything, but unfortunately, the platform target for Console App is still X86 but in fact we are on SP 2010 server which is always going to be a 64 bit machine.
- Goto project properties of console app.
- Click Builds tab
- Change the Target Platform to "Any CPU"
- And you should get your SPSite object instantiated successfully.