今天在运行一个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. Intent的跳转和传值

    看了Intent的使用方法,感觉还是要做一些笔记的,首先对于Intent的跳转Activity这个功能的实现就有两种方法,也可以说有三种: 1.                  2.

  2. 安装nginx和php

    安装nginx 1.安装依赖包 yum -y install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel perl pe ...

  3. HTML5 CSS3 精美案例 : 实现VCD包装盒个性幻灯片

    转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/31015121 哈,首先感谢下w3cfuns的老师,嗯~ 好了,这次给发夹分享一个 ...

  4. 把一个机器上1天内新增的文件用rsync传送到另外一台机器

    我的shell很菜,只好用shell和php结合来做 1.查找新增的文件,构造rsync的参数,把结果写入到log中 find /data/bmob/test/teststorage/data/ -m ...

  5. apigateway-kong(一)简介及部署

    时隔三年,本人重出江湖,哈哈哈 浏览之前写的博客,有些深度还不是太够.篇幅太短,并且很多专题没有坚持写下去,部分技(dai)术(ma)没有从业务中抽离出来,本人感觉好遗憾--为此,痛下决心,重拾博客, ...

  6. 从一个例子了解window.onload、$(function(){})、$(window).load(function(){})的加载顺序

    最近遇到一个轮播需求: 1. ajax请求服务器,返回json,判断json数据里每一项中isFix属性是0还是1,0表示不轮播,1表示需要轮播. 2. 当isFix属性为0的时候,表示该图片不轮播, ...

  7. SDOI2017 BZOJ 4820 硬币游戏 解题报告

    写在前面 此题网上存在大量题解,但本人太菜了,看了不下10篇均未看懂,只好自己冷静分析了.本文将严格详细地论述算法(避免一切意会和玄学),因此可能会比其它题解更加理论化一些,希望能对像我一样看了其它题 ...

  8. bzoj4067 [Ctsc2015]gender

    好神的一道题啊! 我们发现题目中的ln的贡献非常傻逼,但是我们可以发现这个东西的取值只有40个左右,于是我们可以枚举他! 枚举完了对于题里的贡献就是一个普通的最小割,采用的是文理分科的思想,与S连代表 ...

  9. 【二分+容斥+莫比乌斯反演】BZOJ2440 完全平方数

    Description 求第k个没有完全平方因子的数,k<=1e9. Solution 这其实就是要求第k个µ[i](莫比乌斯函数)不为0的数. 然而k太大数组开不下来是吧,于是这么处理. 二分 ...

  10. Java 使用PDFBox提取PDF文件中的图片

    今天做PDF文件解析,遇到一个需求:提取文件中的图片并保存.使用的是流行的apache开源jar包pdfbox, 但还是遇到坑了,比如pdfbox版本太高或太低都不能用!!这个包竟然没有很好地做好兼容 ...