1

Summary

The required Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll is not copied to my project's bin directory

Details

I have the following

  • a class project called abc.settings with vitually no references other than the standard one.
  • a class project called abc.settings.extensions.keyvault which is an extension library for abc.settings and has the KeyVault nuget plus the Microsoft.IndentityModels.Clients.ActiveDirectory nuget which is a dependency for KeyVault (amongst others)
  • a project called abc.login which has a reference to both abc.settings and abc.extensions.keyvault

The abc.login application builds ok with no errors but when I run it, I get a runtime aggregate exception which boils down to unable to load module Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll

When I look in the bin folder of abc.settings.extensions.keyvault, Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll is present along with Microsoft.IdentityModel.Clients.ActiveDirectory.dll as expected.

When I look in abc.login\bin\x64, I see a Microsoft.IdentityModel.Clients.ActiveDirectory.dll but no Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll

Things I have tried

  • Ensure copy local is true for both these files
  • Ensured Specific Version is set the same for both these dlls (it is and they were set to true)
  • Reinstalled the nugets
  • installed the ADAL nuget in the abc.login project - this causes the application to work...but it should have been copied because abc.extensions.keyvaul was referenced.
  • I checked out This SO but I can't understand how this is half working (one dll gets copied, the other does not). That post implies this referenced project dll's references should never work.

Any suggestions on why or where else to investigate?

Thank you.

Community
  • 1
  • 1
MarkD
  • 1,511
  • 18
  • 32

1 Answers1

1

solved by this answer

Interesting this answer did not come up as an answer as I was posting but did once I posted.

Relating to my issue, in abc.extensions.keyvault, I added a dummy method to one of the classes that references a type in the missing ....platform.dll then console.writeline the name of that type (this second part avoids an optimization).

    public static void DoNotDeleteOrUse()
    {
        var TypeOfSomething = typeof(Microsoft.IdentityModel.Clients.ActiveDirectory.AdalOption);
        Console.WriteLine(TypeOfSomething.FullName);

    }

Blockquote

Community
  • 1
  • 1
MarkD
  • 1,511
  • 18
  • 32