This is actually a repost from this article, but it seems a lot of people are running into the error so I thought I’d repost it.
If you plan on writing anything that uses the CRM 2011 SDK, you may at some point run into the following error message:
The application terminated with an error.
Could not load file or assembly ‘Microsoft.IdentityModel, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.
You need to install the Windows Identity Foundation which contains a referenced assembly then add that assembly as a reference to your project.