繁体   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