本文介绍了无法加载文件或程序集"Microsoft.IdentityModel.Clients.ActiveDirectory"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我在运行.NET应用程序时遇到的确切异常.

Following is the exact exception I am getting while running my .NET application.

其他信息:无法加载文件或程序集 'Microsoft.IdentityModel.Clients.ActiveDirectory,版本= 2.28.1.741, 文化=中性,PublicKeyToken = 31bf3856ad364e35'或其中之一 依赖关系.系统找不到指定的文件.

Additional information: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.28.1.741, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

我有一个引用私有程序集(.dll)的控制台应用程序.该程序集引用了Microsoft.IdentityModel.Clients.ActiveDirectory,并且我还在项目

I have a console application which references a private assembly (.dll). The assembly is referencing to Microsoft.IdentityModel.Clients.ActiveDirectory, and I have also added a NuGet package for this in the project

<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.1" targetFramework="net46" />

我可以看到在项目中正确引用了DLL.但是,在运行应用程序时,出现如上所述的错误.

I can see the DLLs are being referenced correctly in the project. However, while running the application, I am getting an error as mentioned above.

仅向您简要介绍类库项目-该DLL具有连接到CRM Web API的方法.直到最近几天,它一直运行良好,然后突然停止工作并抛出错误.

Just to give you a brief overview of the class library project - this DLL has methods to connect to CRM web api. This was working fine until last few days, and suddenly stopped working and throwing the error.

我还在Azure函数中使用了相同的DLL,这在它工作得很好的地方.

I am also consuming the same DLL in Azure function which is where it works perfectly fine.

任何人都可以提出解决此问题的建议吗?

Can anyone please suggest how to resolve this issue?

推荐答案

也许您没有该特定版本?您是否尝试过在属性中将特定版本设置为false?

May be you don't have that specific version? have you tried setting specific version to false in properties?

NuGet将不处理程序中的引用.它只管理包.此问题与Visual Studio有关.如果NuGet更新了某些软件包,并且您的程序要求提供特定版本,则肯定会遇到问题.

NuGet won't handle the references in the program. It just manages packages. This issue is with visual studio. If NuGet updates some packages and your program asks for specific version, you will definitely get problems.

这篇关于无法加载文件或程序集"Microsoft.IdentityModel.Clients.ActiveDirectory"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 01:07