web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

C# to CRM: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File nam

(0) ShareShare
ReportReport
Posted on by

Hi

I have an application which is a C# console app that connects to CRM server and creates records in CRM. It throws the below error

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

I have checked the CRM server and can see the Windows Identity Foundation is installed there. I have installed WIF manually in my dev server and added it to the project as a reference.

However the error still exists.

I cannot find the Windows.Identity.Model dll file in the project-->bin-->debug folder after compiling.

Can anyone suggest me how to fix this issue pls?

Regards

Bab

*This post is locked for comments

I have the same question (0)
  • Luxque Xavier Profile Picture
    5 on at
    RE: C# to CRM: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File

    If an assembly is missing in the debug folder that means you have to change the reference properties to copy on local the assembly.

    pastedimage1571128294964v1.png

  • Verified answer
    Community Member Profile Picture
    on at
    RE: C# to CRM: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File

    Hi Guys

    It works now. Initially even though I added the library to the project and compiled it dint work (the dll was not getting saved in the project bin-->debug folder). I manually had to copy dll to the debug folder and copy the app across to the performance server.

    Now it seems to be working.

    Thanks all for you time.

    Regards

    Bab

  • Community Member Profile Picture
    on at
    RE: C# to CRM: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File

    Hi Guys

    I have downloaded and installed WIF from the link already. I have added the reference to this library in my project as well. When I deploy the project to the performance server and run the console app it throws the same error again!

    The performance server also has WIF installed.

    Any other thoughts please.

    Regards

    Bab

  • Verified answer
    David Jennaway Profile Picture
    14,065 on at
    RE: C# to CRM: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File

    Prior to Windows 8, you'd need to download Windows Identity Foundation to install it - you can get it from https://www.microsoft.com/en-us/download/details.aspx?id=17331

    When installed, all the assemblies should be in the GAC (%windir%\assembly), so there should be no need to copy the assembly anywhere

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,188 Moderator on at
    RE: C# to CRM: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File

    Not sure which version of Windows you are using, but you can try using option to Turn Windows features on or off, and from the get the WIndows Identity Foundation 3.5 installed.

    This can be found in Control Panel -> Add/Remove Programs, but only in Windows 8 and above.

    wif_5F00_install1.png

    Once installed, just add it to you project using the Add Reference option in Visual Studio and it should be available

  • Verified answer
    ashlega Profile Picture
    34,477 on at
    RE: C# to CRM: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File

    Usually, I'd just copy that file from

    ..Program Files\Reference Assemblies\Microsoft\Windows Identity Foundation\v3.5

    to the application's folder

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans