skip to Main Content

I just recently published my asp.net api with linux and everything worked just fine.
Then I decided to make some changes to my code:

  • Delete email service that I no longer need. I already ensured that it did not have any reference to others.

I pulled new changes to the hosting server from github and then redeployed with below commands.

 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/

Then restart afterward

 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

Then the error occured, even though my local application still working just fine.

 * 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.*

I already checked the version, its the same.
And right away I reverted the commit on github and tried to redeploy but it still generated the same error.

I would appreciate any help or suggestions on what the real problem is !!

2

Answers


  1. Chosen as BEST ANSWER

    Turned out that at the last deployment I did not switch to the myApp.api directory and end up deployed at the wrong directory thats why it could not find some files. To resolve, all assemblies with .dll extension have to be deleted and make a clean rebuild.


  2. I received the same error when attempting to use FluentAssertions Nuget with MSTest. I don’t think FluentAssrtions is compatible with MSTest. Works good with NUnit and XUnit testing.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search