簡體   English   中英

.NET Web發布后缺少dll

[英]dlls missing after publishing .NET Web

我的Web項目使用.NET Framework 4.7.2並使用一些參考,例如

  • System.IO
  • System.Net
  • System.Net.Http
  • System.Net.Http.Formatting

我的項目在本地完美運行。 但是,當我將Web項目發布到目標目錄(用於在線)並查看/bin/包含的內容時:

  • 缺少 System.IO
  • System.Net存在
  • System.Net.Http 丟失
  • 存在System.Net.Http.Formatting

因此,當我使用我的網站時,出現明顯錯誤: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

所有引用的“ Properties均為“ Copy Local = True ,但某些dll始終被忽略。 如果我將dll從本地目錄復制到目標目錄,則會Server Error in '/' Application. Cannot load a reference assembly for execution. Exception Details: System.BadImageFormatException: Cannot load a reference assembly for execution.收到錯誤Server Error in '/' Application. Cannot load a reference assembly for execution. Exception Details: System.BadImageFormatException: Cannot load a reference assembly for execution. Server Error in '/' Application. Cannot load a reference assembly for execution. Exception Details: System.BadImageFormatException: Cannot load a reference assembly for execution. 與此完全相同的問題。 但是,刪除/重建解決方案或添加編譯選項解決方案對我不起作用

我需要怎么做才能將這些丟失的dll放入目標文件夾?

轉到VS上的解決方案資源管理器,打開引用樹,右鍵單擊library(dll)並在菜單上選擇屬性。 在屬性框上, “本地復制”應為True

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM