I just upgraded from SpecFlow v2.41 to v3.5.14. When running my tests, all of them fail at the end of their first step. All fail with the following same error:
_System.IO.FileLoadException: Could not load file or assembly 'TechTalk.SpecFlow, Version=2.4.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)_
I believed I followed the upgrade instructions correctly from this link https://specflow.org/blog/updating-to-specflow-3/ . I must be missing a configuration setting somewhere but I cannot figure what that is.
My setup contains the following
Visual Studio 2019 (Enterprise version 4.8.03761)
Packages (using 'PackageReference' tags):
o SpecFlow v3.5.14
o SpecFlow.MsTest v3.5.14
o SpecFlow.Tools.MsBuild.Generation v3.5.14
The Enable SpecFlowSingleFileGenerator Custom Tool option is set to False
I have been stuck for a few days now trying to figure this out and thought I would reach out for help. Any ideas or suggestions to try?
Thank you in advance.
Normally in this cases, there are some left over files in the output directory from the old SpecFlow version.
Try to delete the obj and bin folder and try again to execute it.
THANK YOU!
You pointed me towards the direction on where to look. It turns out my test project is referencing an internal package that had the old SpecFlow version reference. Once I upgraded SpecFlow to the same version (3.5.14) in this internal package all my tests now run and pass.
Thank you again for taking the time to look at and respond to my inquiry.
Glad to hear that it is now working for you.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
THANK YOU!
You pointed me towards the direction on where to look. It turns out my test project is referencing an internal package that had the old SpecFlow version reference. Once I upgraded SpecFlow to the same version (3.5.14) in this internal package all my tests now run and pass.
Thank you again for taking the time to look at and respond to my inquiry.