MS Fakes unit tests failing after Visual Studio 2013 Update 4

血红的双手。 提交于 2019-12-18 02:17:12

问题


I have recently upgrade from Microsoft Visual Studio 2013 Update 3 (Premium edition) to Microsoft Visual Studio 2013 Update 4 (Premium edition) and now my existing unit test projects have stopped compiling. It fails with the error:

The type 'Microsoft.QualityTools.Testing.Fakes.Stubs.StubBase`1' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

We, along with a lot of other people, had a similar issue where a bug was introduced in VS2013 that could be resolved by manually deleting the .messages file (via File Explorer or solution explorer with view all files enabled) inside FakesAssemblies folder inside the project folder. This however doesnt fix the issue, even if I delete the entire FakesAssemblies folder.

The reference to the project (including correct version is their within the project). I have deleted the reference and readded it and it has no effect, they still fail to compile.

The unit test projects still compile and pass on other colleagues machines with Visual Studio 2013 Update 3.

New projects unit test projects using MS fakes also fail to build.

So short of, uninstalling the Update 4 is there anything else I can try?

If not I'll log a bug on Microsoft Connect.


回答1:


In the reference properties for Microsoft.QualityTools.Testing.Fakes, change "Specific Version" property to FALSE. Doing so will allow Visual Studio 2013 to use whatever version of Microsoft.QualityTools.Testing.Fakes is installed on your machine.

With Visual Studio 2013 Update 4, Microsoft incremented the version number of Microsoft.QualityTools.Testing.Fakes.dll from 11.0 to 12.0; this is what caused things to break.




回答2:


  1. the fix was to remove all references ending with .FAKES (including the Microsoft.QualityTools.Testing.Fakes.dll reference).
  2. I also removed the FAKES folder
  3. Cleaned solution
  4. Then readded all references back in.

We had some further errors to do with Shims but we just converted these to Stubs.

We had to upgrade all our projects this way manually, all VS instances including the build server.




回答3:


Try to clean the whole project and compile it again, that worked for me!




回答4:


After trying all answers here, It finally worked for me. The code:

using (ShimsContext.Create())

(used to) throw:

Failed to get address of function SetDetourProvider from library 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\vsperfcorprof.dll'.

My test project is running in 2012. I replaced the following dlls with these:

  • Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll (version: 10.1.0.00, file version: 11.0.60610.1)
  • Microsoft.QualityTools.Testing.Fakes.dll (version: 11.0.0.0, file version: 11.0.60315.1)

They were located in:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\

Hope it helps.




回答5:


I added the followings assemblies and rebuilt my solution. It started to work for me. A. C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.QualityTools.Testing.Fakes.dll

B. C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll



来源:https://stackoverflow.com/questions/26934260/ms-fakes-unit-tests-failing-after-visual-studio-2013-update-4

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