Could not load file or assembly……
今天在运行一个ASP.NET Core项目的时候发现这样的错误:

我一开始觉得这是个很简单的问题,很明显,出错的原因是项目中某些地方还保留了对Njt.MvcAuthLib这个库的引用,而现在我不需要了,只需要把相关的引用去掉就可以了,我搜索了整个项目,很奇怪,没有任何关于MvcAuthLib的字样,一个都没有,难道Visual Studio的搜索有问题?我换了Visual Studio Code,一样,尝试数次,问题依旧,没有地方引用到它。
后来我想到了,没有直接引用,那会有间接引用吧,因为我是用Nuget来处理类库的依赖关系,我看看我引用的类库哪个有引用到Njt.MvcAuthLib不就行了?但我非常仔细的一个个看下来了——没有!这就奇怪了!
死马当活马医,重新创建项目,添加引用,再把源代码文件拷贝进去,编译,运行,问题还在!
最后发现问题是这样的,这个项目引用了一个自己开发的库,这个被引用的库确实使用到了Njt.MvcAuthLib,但它的Nuget包并没有指定这个依赖关系,所以编译时看不出错误,Nuget依赖关系也查不出错误,只有在运行时才会发现缺失Njt.MvcAuthLib,这是个很低级的错误,却花了不少时间,分享出来让大家注意下这个坑。
Could not load file or assembly……的更多相关文章
- configuration error-could not load file or assembly crystaldecisions.reportappserver.clientdoc
IIS启动网站后报错: configuration error Could not load file or assembly 'crystaldecisions.reportappserver.cl ...
- Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its de
页面加载时出现这个错误: Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Cul ...
- Could not load file or assembly 'System.ServiceModel.DomainServices.Hosting'.系统找不到指定文件
项目部署到服务器后出现如下错误信息: Parser Error Message: Could not load file or assembly 'System.ServiceModel.Domain ...
- ASP.NET corrupt assembly “Could not load file or assembly App_Web_*
以下是从overFlow 复制过来的问题 I've read through many of the other questions posted on the same issue, but I s ...
- Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=11.0.0.0 系统找不到指定的文件。
环境: web服务器: ip:192.168.1.32 ,安装有 Visual Studio Premium 2013 操作系统: Microsoft Server 2008 r2+sp1 数据库服 ...
- NopCommerce 发布时 Could not load file or assembly 'file:///...\Autofac.3.5.2\lib\net40\Autofac.dll' or one of its dependencies
本文转自:http://www.nopcommerce.com/boards/t/33637/4-errors.aspx 问题: The 3.5 solution compiles fine, and ...
- Could not load file or assembly 'MySql.Data.CF,
Could not load file or assembly 'MySql.Data.CF, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c56 ...
- Could not load file or assembly 'System.Data.SQLite' or one of its dependencies
试图加载格式不正确的程 异常类型 异常消息Could not load file or assembly 'System.Data.SQLite' or one of its dependencies ...
- System.BadImageFormatException: Could not load file or assembly
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>InstallUtil.exe C:\_PRODUKCIJA\Debug\DynamicHtmlT ...
- Could not load file or assembly Microsoft.Web.Infrastructure
Error info:Could not load file or assembly 'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=n ...
随机推荐
- sql server 阻塞查询
在生产环境下,有时公司客服反映网页半天打不到,除了在浏览器按F12的Network响应来排查,确定web服务器无故障后.就需要检查数据库是否有出现阻塞 当时数据库的生产环境中主表数据量超过2000w, ...
- 监控与管理dubbo服务
Dubbo是阿里多年前开源的一套服务治理框架,在众多互联网企业里应用广泛.本文介绍了一些如何监控与管理dubbo服务.使用的工具与<dubbox 的各种管理和监管>大致相同,本文更侧重于命 ...
- ORA-12737: Instant Client Light: unsupported server character set CHS16GBK
当使用Navicat Premiun 英文版连接oracl时可能会报ORA-12737: Instant Client Light: unsupported server character set ...
- 最近最久未使用页面淘汰算法———LRU算法(java实现)
请珍惜小编劳动成果,该文章为小编原创,转载请注明出处. LRU算法,即Last Recently Used ---选择最后一次访问时间距离当前时间最长的一页并淘汰之--即淘汰最长时间没有使用的页 按照 ...
- 【bzoj3598】: [Scoi2014]方伯伯的商场之旅
Description 方伯伯有一天去参加一个商场举办的游戏.商场派了一些工作人员排成一行.每个人面前有几堆石子.说来也巧,位置在 i 的人面前的第 j 堆的石子的数量,刚好是 i 写成 K 进制后的 ...
- BZOJ_5118_Fib数列2_矩阵乘法+欧拉定理
BZOJ_5118_Fib数列2_矩阵乘法+欧拉定理 Description Fib定义为Fib(0)=0,Fib(1)=1,对于n≥2,Fib(n)=Fib(n-1)+Fib(n-2) 现给出N,求 ...
- hibernate 5.2.12配置
//创建服务注册对象 ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().configure() ...
- supervisord supervisorctl 问题supervisor.sock refused connection
如果supervisord挂了的话,提示supervisor.sock refused connection. ,重新启动命令为supervisord 常用命令: supervisord -c /et ...
- mysql循环插入数据
实验中经常会遇到需要多条数据的情况就想到了用SQL语句循环生成数据 DROP PROCEDURE if EXISTS test_insert; DELIMITER ;; CREATE PROCEDUR ...
- Python从入门到放弃
计算机基础 01 计算机基础之编程 02 计算机组成原理 03 计算机操作系统 04 编程语言分类 Python解释器 05 Python和Python解释器 06 执行Python程序的两种方式 0 ...