2015-05-05 3 views
9

У меня есть пакет Moq nuget, установленный из Manage Nuget Packages для моего проекта. Проект строит успешно, но когда я запустить тестовый случай, он выдает следующую ошибкуНе удалось загрузить файл или сборку Moq, 4.2.1502.911 или одну из его зависимостей

System.IO.FileLoadException: Could not load file or assembly 'Moq, Version=4.2.1502.911, Culture=neutral, PublicKeyToken=69f491c39445e920' or one of its dependencies 

Я проверил ссылки на проекты и Moq.dll есть.

Также я заметил это на выходном окне для тестового прогона

------ Discover test started ------ 
Unable to load the test container 'C:\dev\tfs\Main\GUI\Gui.Client\Bin\Debug\Gui.Client.dll' or one of its dependencies. Error details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows, Version=5.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified. 
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Practices.Prism, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. 
System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified. 

========== Discover test finished: 20 found (0:00:03.4941998) ========== 
------ Run test started ------ 
Warning: conflict during test run deployment: deployment item 'c:\dev\tfs\main\gui\test\gui.client.state.tests\bin\debug\Moq.dll' directly or indirectly referenced by the test container 'c:\dev\tfs\main\gui\test\gui.client.state.tests\bin\debug\gui.client.state.tests.dll' cannot be deployed to 'Moq.dll' because otherwise the file 'c:\dev\tfs\main\gui\test\gui.client.state.tests\bin\debug\Moq.dll' would overwrite deployment item '..\ThirdPartyLibraries\NuGetPackages\Moq.4.2.1402.2112\lib\net40\Moq.dll' specified by the test settings. 
Warning: Test Run deployment issue: The assembly or module 'NMath' directly or indirectly referenced by the test container 'c:\dev\tfs\main\gui\test\gui.client.state.tests\bin\debug\gui.client.state.tests.dll' was not found. 
========== Run test finished: 1 run (0:00:23.2373118) ========== 
+1

Вы нашли решение этой проблемы? Я столкнулся с аналогичной проблемой с той же ошибкой. У меня есть некоторые пакеты nuget для тестирования (и я подозреваю, что Ninject.MockingKernel является триггером этого поведения), и они отлично работают в плагине nunit VS test runer (тесты выполняются и работают нормально), но в nunit gui я получаю эту ошибку и потратить некоторое время не смогли локализовать эту проблему. – SerrNovik

+0

Убедитесь, что пользователь, выполняющий VS, получил доступ для чтения к папке dll. Вы также можете попробовать переустановить пакеты Nuget. –

ответ

4

была такая же проблема. Обновлены Moq nugets для всех проектов, и все они используют одну и ту же библиотеку Moq, и она отлично работает для меня.

щелкните правой кнопкой мыши по ссылке Moq и убедитесь, что вы используете ту же версию везде. если не обновить использование менеджера пакетов nuget

Смежные вопросы

 Смежные вопросы