问题
I have seen this question before but I believe it was not resolved. Basically my set up is this: VS 2015 Specflow ver 1.9.0 (I downgraded to this from 2.1.0 based on other question which didn't help)
When I try to build my project, it comes with the follwoing error:
#error Generation error: Could not load file or assembly 'TechTalk.SpecFlow, Version=1.9.0.77, Culture=neutral, PublicKeyToken=0778194805d6db41' or one of its dependencies. The system cannot find the file specified.
回答1:
Check your package.config and see if it has an entry for TechTalk.SpecFlow. If yes, then delete the entry from package config file ... as well delete all the assembly related to that dll. Re-install the specific version from NuGet and re-compile your project.
Per your comment it still targeting the new version newVersion="2.1.0.0" and not the new version Version=1.9.0.77. Change your app.config like to be
<assemblyIdentity name="TechTalk.SpecFlow" publicKeyToken="0778194805d6db41" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="1.9.0.77" />
回答2:
Just uninstall specflow from VS menu - Tools >> Extension and Updates and reinstall. It will ask for VS restart while doing so and you are all set.
来源:https://stackoverflow.com/questions/39316353/techtalk-specflow-error-could-not-load-assembly-file-or-assembly