solidtoken / SpecFlow.DependencyInjection

SpecFlow plugin that enables to use Microsoft.Extensions.DependencyInjection for resolving test dependencies.
BSD 3-Clause "New" or "Revised" License
35 stars 11 forks source link

DLL is not copied to NCrunch workspace since 0.6.0 #36

Closed RemyBoyer closed 3 years ago

RemyBoyer commented 4 years ago

Hi there!

We've had issues using NCrunch with the plugin latest version 0.6.0.

I understand that NCrunch might not be an official "supported" test runner, but I'd still like to know if we can make it work again.

FYI, here's a conversation I've had with the NCrunch team, which explains that with 0.4.0, the dll is successfully copied to the NCrunch workspace, but is not with 0.6.0: https://forum.ncrunch.net/yaf_postst3065_Package-Reference-no-longer-copied-after-being-updated.aspx

The problem is that when the file isn't copied, Specflow won't load the plugin. When using the Visual Studio test runner, it works fine.

It looks to me like it's this removal that make the file not to be copied to the workspace folder anymore: https://github.com/solidtoken/SpecFlow.DependencyInjection/commit/679f8f195521adbb07344841da56f4fb296d2e6c#diff-d801e55d67289561fed2dabe4129bd8e01f3c4652c69bea6b744e938582ba45b

From what I understand, the documentation recommends that this file should be present: https://docs.specflow.org/projects/specflow/en/latest/Extend/Plugins.html#build-specflow-sampleplugin-props

Am I missing something? Was this removal intentional and related to some updates to SpecFlow? Would it be possible to bring it back?

Thank you

mbhoek commented 3 years ago

@RemyBoyer Apologies for not getting back to you earlier and thank you for your elaborate bug report 👍 Now that v1.0.0 (with .NET 5 support) is released, I would like to help you solve this issue.

The reason for dropping the .props/.targets file was because before .NET Framework 4.6.1 it was needed to copy a different plugin DLL to the output folder depending on whether it was compiled for .NET Framework or .NET Core. With the release of .NET Framework 4.6.1 this was no longer needed (net461 has full support for netstandard2.0), and because SpecFlow decided to support only 4.6.1 or up, I decided to remove the .props/.targets files for simplicity.

So my first question for you would be: what framework are you targeting? .NET Framework or .NET core? Which version? Which version of SpecFlow would you like to use?

RemyBoyer commented 3 years ago

Hi @mbhoek, thanks for coming back to me.

I'm using netcoreapp3.1 and Specflow 3.7.13.

We actually also hit the issue #37, before it was reported here by someone. Since this issue took so much time to get attention, I thought that creating a new one will not provide us a quick solution. I thought about creating a PR too, but we were quite busy at the time. We've decided to switch to AutoFac, as it is officially supported by SpecFlow and shipped at the same pace. It took us an hour or two to migrate.

This issue with NCrunch still stands, but as I'm not using the library anymore, I suppose you can close it :)

Thank you for the work you've put into the lib. We have used it for more than a year and was a piece of the ecosystem that helped us to keep the same level of quality for our software.

mbhoek commented 3 years ago

Thanks for letting me know @RemyBoyer and sorry about the extra work I caused you. I'm hoping to do a better job of maintaining the lib going forward.

RemyBoyer commented 3 years ago

No worries. We can't expect open source maintenance as an entitlement. I'm just glad I was able to use the lib for some time, and I guess that you should too 😃

mbhoek commented 3 years ago

FWIW your analysis was spot-on and made it relatively easy for me to test and fix. 👏

Verified with NCrunch 4.8 for both .NET Core 3.1 and .NET Framework 4.6.1 (although the latter raises the warning "Abnormal runtime assembly reference resolution detected" it still works as expected).