今天在运行一个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……的更多相关文章

  1. configuration error-could not load file or assembly crystaldecisions.reportappserver.clientdoc

    IIS启动网站后报错: configuration error Could not load file or assembly 'crystaldecisions.reportappserver.cl ...

  2. 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 ...

  3. Could not load file or assembly 'System.ServiceModel.DomainServices.Hosting'.系统找不到指定文件

    项目部署到服务器后出现如下错误信息: Parser Error Message: Could not load file or assembly 'System.ServiceModel.Domain ...

  4. 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 ...

  5. 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 数据库服 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. System.BadImageFormatException: Could not load file or assembly

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319>InstallUtil.exe C:\_PRODUKCIJA\Debug\DynamicHtmlT ...

  10. 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 ...

随机推荐

  1. WPF MVVM UI分离之《交互与数据分离》

    在我们使用WPF过程中,不可避免并且超级喜欢使用MVVM框架. 那么,使用MVVM的出发点是视觉与业务逻辑分离,即UI与数据分离 诸如下面的问题: 删除操作,假如需要先执行一部分数据的处理,然后删除界 ...

  2. Zookeeper vs etcd vs Consul

    Zookeeper vs etcd vs Consul [编者的话]本文对比了Zookeeper.etcd和Consul三种服务发现工具,探讨了最佳的服务发现解决方案,仅供参考. 如果使用预定义的端口 ...

  3. django从0到1搭建网站

    曾经有人说我前端很水,那么在这一系列文章中我打算把前后端融合在一起来做一次网站的全面重构,希望可以把刚刚入行的同学带上正途   请尊重原创,转载请注明来源网站www.shareditor.com以及原 ...

  4. WebJars

    WebJarsWebJars是一个很神奇的东西,可以让大家以jar包的形式来使用前端的各种框架.组件. 什么是WebJars 什么是WebJars?WebJars是将客户端(浏览器)资源(JavaSc ...

  5. Array.prototype.slice.call()方法详解

    在很多时候经常看到Array.prototype.slice.call()方法,比如Array.prototype.slice.call(arguments),下面讲一下其原理: 1.基本讲解 1.在 ...

  6. Python常用算法(二)

    1.快速排序 过一趟排序将要排序的数据分割成独立的两部分,其中一部分的所有数据都比另外一部分的所有数据都要小 一般选取第一个数作为关键数据k,我们要把比k小的所有数据移到它的左面,从后往前找第一个比它 ...

  7. Mac下将文件复制到移动硬盘

    在Mac下将移动硬盘格式化成exfat,这样Mac和Windows都可以对移动硬盘进行识别

  8. Go 延迟函数 defer 详解

    Go 延迟函数 defer 详解 Go 语言中延迟函数 defer 充当着 try...catch 的重任,使用起来也非常简便,然而在实际应用中,很多 gopher 并没有真正搞明白 defer.re ...

  9. java happens-before原则规则

    程序次序规则:一个线程内,按照代码顺序,书写在前面的操作先行发生于书写在后面的操作: 锁定规则:一个unLock操作先行发生于后面对同一个锁额lock操作: volatile变量规则:对一个变量的写操 ...

  10. mysql循环插入数据

    实验中经常会遇到需要多条数据的情况就想到了用SQL语句循环生成数据 DROP PROCEDURE if EXISTS test_insert; DELIMITER ;; CREATE PROCEDUR ...