2015-05-05 12 views
9

Ho installato il pacchetto Moq nuget da Gestisci pacchetti Nuget per il mio progetto. Progetto costruisce con successo, ma quando ho eseguito il test case, getta seguente erroreImpossibile caricare il file o l'assembly 'Moq, 4.2.1502.911 o una delle sue dipendenze

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

ho controllato riferimenti del progetto e Moq.dll c'è.

Inoltre ho notato questo sulla finestra di output per test

------ 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

Hai trovato una soluzione a questo problema? Mi imbatto in un problema simile con lo stesso errore. Ho alcuni pacchetti di nuget per il testing (e sospetto che Ninject.MockingKernel sia l'innesco di questo comportamento) e funzionano bene nel VS test runer nunit plugin (test eseguiti e funzionano bene), ma in nunit gui ottengo questo errore e passare un po 'di tempo non è stato in grado di localizzare questo problema. – SerrNovik

+0

Assicurarsi che l'utente che esegue VS abbia accesso in lettura alla cartella dll. Puoi anche provare a reinstallare i pacchetti Nuget. –

risposta

4

avuto lo stesso problema. Aggiornato i nugget Moq per tutti i progetti, tutti usano la stessa libreria Moq e ha funzionato bene per me.

fare clic con il pulsante destro del mouse sul riferimento Moq e assicurarsi di utilizzare la stessa versione in tutto il mondo. se non aggiorni l'utilizzo del gestore pacchetti nuget

Problemi correlati