Skip to main content

Notifications

Announcements

No record found.

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 Microsoft Employee

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

  • Luxque Xavier Profile Picture
    Luxque Xavier 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
    Community Member Microsoft Employee 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
    Community Member Microsoft Employee 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
    David Jennaway 14,063 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 Profile Picture
    Aric Levin 30,188 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
    ashlega 34,475 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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans