I am working with Visual Studio 2010, and when I tried to add Microsoft.SharePoint.dll to a Windows Application then build the solution.
I found out a strange behavior where Microsoft.SharePoint.dll was removed from the reference list automatically.
In this article, I elaborates How to use SharePoint Object Model in Windows Application by following the mentioned steps below:
- Go to solution > Right click > Properties.
- Select Application Tab > Target frameworks.
- Change Target Framework from .Net Framework 4 client profile to .Net framework 3.5.
- Go back to Build Tab > Platform Target.
- Change Platform Target from 86x to 64x.
- Try to add Microsoft.SharePoint.dll reference again that should be now worked properly.