【问题标题】:System.IO.FileNotFoundException: Could not load file or assembly 'FluentAssertions, Version=5.10.3.0System.IO.FileNotFoundException:无法加载文件或程序集'FluentAssertions,版本 = 5.10.3.0
【发布时间】:2021-10-04 12:18:52
【问题描述】:

我最近刚刚用 linux 发布了我的 asp.net api,一切正常。 然后我决定对我的代码进行一些更改:

  • 删除我不再需要的电子邮件服务。我已经确保它没有引用其他人。

我从 github 拉取了对托管服务器的新更改,然后使用以下命令重新部署。

 cd myapp.Api
 sudo dotnet clean
 sudo dotnet build --configuration Release
 sudo systemctl stop myappweb.com.service
 sudo dotnet publish -c release -o /var/www/myappweb.com/api/

然后重启

 sudo systemctl restart nginx
 sudo systemctl stop myappweb.com.service
 sudo systemctl enable myappweb.com.service
 sudo systemctl start myappweb.com.service
 sudo systemctl status myappweb.com.service
 sudo journalctl -fu myappweb.com.service

然后发生了错误,即使我的本地应用程序仍然可以正常工作。

 * Unhandled exception. System.IO.FileNotFound. Could not load file or assembly 'FluentAssertions, Version=5.10.3.0, Culture=neutral, PublicKeyToken=22f2441a05b241b4a'. The system cannot find the file specified.*

我已经检查了版本,它是一样的。 我立即恢复了 github 上的提交并尝试重新部署,但它仍然产生了同样的错误。

我将不胜感激任何有关真正问题的帮助或建议!

【问题讨论】:

  • 这是一个很奇怪的文件名。

标签: c# asp.net linux deployment .net-assembly


【解决方案1】:

原来在上次部署时我没有切换到 myApp.api 目录并最终部署在错误的目录中,这就是它找不到某些文件的原因。 要解决此问题,必须删除所有扩展名为 .dll 的程序集并进行干净的重建。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多