ADFS 2.0: “Could not load file or assembly ‘Microsoft.IdentityServer.Compression’ or one of its dependencies. An attempt was made to load a program with an incorrect format”

If you have come to this blog searching for the error mentioned above then probably you’re doing some modifications to ADFS 2.0 site.

Following would be the symptoms that you have done so far:

  • You have opened adfs\ls website as Website project in Visual Studio.
  • If the project type is Website, you probably had a message from Visual Studio to upgrade for the .Net v4.0.
  • You have created a new project Empty Web Application and imported adfs\ls website content to the project.
  • You are modifying this site/application on local machine and not on Windows Server where ADFS is installed.

Follow these steps to successfully start modifying ADFS site:

  1. Install Visual Studio 2010 on Windows Server where ADFS is installed and configured.
  2. Create an Empty Web Application
  3. Import all the files from adfs\ls directory to the Web Application. (generally, you can find it on c:\inetpub\adfs\ls)
  4. Right click on the project in Solution Explorer and click on “Convert to Web Application”.
  5. You’re ready to go!

You do not need to add reference of any files to this web application. Just Build and Publish the site to the same directory where adfs is installed.

Microsoft.IdentityServer.Compression and other required files will be referenced from GAC as you are developing the project on the server itself.

Happy Programming! 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s