Resharper 7 on VS2012 ignores assembly redirect in app.config

左心房为你撑大大i 提交于 2020-01-03 19:33:11

问题


We use moq and AutoMoq with mstest, and since upgrading to VS2012 and ReSharper 7, we the tests run fine with mstest, but fail when using the R# unit test runner with:

Test method [...] threw exception: 
System.IO.FileLoadException: Could not load file or assembly 
'Moq, Version=3.1.416.3, Culture=neutral, PublicKeyToken=69f491c39445e920' 
or one of its dependencies. The located assembly's manifest definition does not 
match the assembly reference. (Exception from HRESULT: 0x80131040)

AutoMoq is built against Moq 3.1.416.3 and we use 4.0.10827.0, and have an assembly redirect in the app.config. This runs fine both locally with mstest and remotely on the TFS build server, but not when using the R# unit test runner.

After a good amount of searching, I have only found a single thread on the JetBrains forum, without a resolution, so I'll pose the issue to SO too.


回答1:


There is a confirmed bug in mstest stating that assembly redirects don't work. There is a known workaround: if you have a testsettings file assembly redirect do work. I guess R# does not run the tests the same way as mstest. I think mstest actually ignores the app.config now, but that is my speculation. There is a reported issue for R#:

http://youtrack.jetbrains.com/issue/RSRP-329567

and this is the ms forum post where they confirm the bug:

http://social.msdn.microsoft.com/Forums/en-US/vsunittest/thread/234926d1-42c0-4ebb-af39-1626e72f6c39

I do hope we could vote for this bug being fixed somewhere...

And there is another post here on SO with the same issue:

assemblybinding does not work in mstest



来源:https://stackoverflow.com/questions/12357696/resharper-7-on-vs2012-ignores-assembly-redirect-in-app-config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!