1. 程式人生 > >Could not load file or assembly……

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 'System.Core, Version=2.0.5.0 和autofac沖突的問題

ring led sem form pic red origin ack could 在部署到iis的時候會出現這個狀況。 解決:下載安裝這個補丁 http://support.microsoft.com/kb/2468871 http://www.microsoft

[Nuget] - "Runtime error: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0'" 問題之解決

未能加載文件 nuget man 5.0 install ges 成功 could not .com 環境 項目中使用了 System.Web.WebPages.Razor, Version=3.0.0.0,Nuget 還原缺失包後自動更新至 Version=3.2.5.0

iis配置問題報錯 -- Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies

could not ans 程序 sys logs info req exc 方案 具體提示: Could not load file or assembly ‘Oracle.DataAccess‘ or one of its dependencies. 試圖加載格

Could not load file or assembly 'System.Core, Version=2.0.5.0

ould tps 安裝 5.0 not com .aspx mic details 項目中用的4.0,本機沒問題,服務器上出現問題,查了一下發現 autofac 裏面用的這個版本 解決:下載安裝這個4.0的補丁 http://support.microsoft.c

Could not load file or assembly 'System.Web.Mvc, Version=5.2.3.0...

3.0 view version img strong pre views str system 一、在Mvc 發布時出現如下錯誤: Could not load file or assembly ‘System.Web.Mvc, Version=5.2.3.0...

解決Could not load file or assembly CefSharp.Core.dll的問題

sha not com 找不到 需要 .aspx for 區分 soft 這個問題的中文提示是: 未能加載文件或程序集“CefSharp.Core.dll”或它的某一個依賴項。找不到指定的模塊 具體原因是因為CefSharp運行時需要Visual C++ Redistrib

Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencie

Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The locate

Could not load file or assembly 'System.Core, Version=2.0.5.0 和autofac衝突的問題

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information abou

Could not load file or assembly……

今天在執行一個ASP.NET Core專案的時候發現這樣的錯誤: 我一開始覺得這是個很簡單的問題,很明顯,出錯的原因是專案中某些地方還保留了對Njt.MvcAuthLib這個庫的引用,而現在我不需要了,只需要把相關的引用去掉就可以了,我搜索了整個專案,很奇怪,沒有任何關於MvcAuthLib的字樣,一個

關於在IIS伺服器上執行asp.net Web程式出現下面 “Could not load file or assembly。。。”問題的

Could not load file or assembly 'System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of

關於 Unable to load class 'kotlin.collections.CollectionsKT' 或Error:Could not initialize class or報錯記錄

關於Error:Could not initialize class org.jetbrains.kotlin.kapt.idea.KaptModelBuilderService或者Unable to load class 'kotlin.collections.Collec

ssh報錯:Could not load host key:/etc/ssh/ssh_host_rsa_key&ssh_host_ecdsa_key&ssh_host_ed25519_key

ssh報錯:could not load host key今天ssh遠程的時候發現無法遠程,登錄主機查看ssh服務狀態,報錯如下去查看秘鑰發現文件大小為0,看起來是生成秘鑰失敗了才導致的故障,解決方法簡單,刪除原有的秘鑰,重新生成秘鑰就OK了然後重啟ssh服務,自動生成新的秘鑰就可以了或者也可以通過命令行重新

Could not load the FreeMarker template named 'select'

今天 struts2 dsm eem str ng- 問題 lec 其它 眼下項目使用struts2, 所以頁面中就使用到了struts2的標簽,可是今天在做新的功能的時候突然出現 “Could not load the FreeMarker template n

搭建jfinal框架時報 Could not load driverClass com.mysql.jdbc.Driver

aid targe 服務 http driver follow 也有 -i 框架 搭建jfinal框架時報 Could not load driverClass com.mysql.jdbc.Driver 沒有加載MySQL的驅動,你有沒有把mysql的驅動包放到你項目的W

解決Sqoop報錯Could not load db driver class: com.intersys.jdbc.CacheDriver

cti writer cman sql make time nec generate ava 報錯棧: 17/06/16 17:46:01 INFO tool.CodeGenTool: Beginning code generation 17/06/16 17:46

關於Could not load driverClass ${jdbc.driverClassName}問題解決方案

ref 代碼 per 配置 pri 分析 jdbc 方法 裝配 在spring與mybatis3整合時一直遇到Could not load driverClass ${jdbc.driverClassName}報錯如果將 ${jdbc.driverClassName} 改成

ubuntu 修復 could not open file '/etc/apt/sources.list'

本地 除了 管理器 src 更新 http 關閉 相關 mage 問題描述:could not open file ‘/etc/apt/sources.list‘ 問題分析:軟件源被清空了,也就是 /etc/apt/sources.list 被刪除了 解決問題:1、打開更新

could not load host key: /etc/ssh/ssh_host_rsa_key 無法啟動ssh的一個解決辦法

could not load host key: /etc/ssh/ssh_host_rsa_key 無法啟動ssh的一個解決辦法# /usr/sbin/sshd系統提示“Could not load host key: /etc/ssh/ssh_host_keyCould not load host key

linux中ftp提示--553 Could not create file

col 阿裏 nbsp pre log 原因 ould eat span 今天在阿裏雲的linux上搭建ftp服務的時候,搭建成功之後,上傳文件時總提示553 Could not create file,找了半天原因,終於解決了 ftp主目錄為/home/myftp ch

PL/SQL Developer 問題:Initialization error Could not load ".../oci.dll"

問題: PL/SQL Developer 啟動後報錯:Initialization error Could not load   .....  oci.dll 解決方法: 選單欄選擇 Tools -> Preferences -> Oracle