2011-08-04 19 views
5

की ओर जाता है जब मैं इस तरह के रूप में एक समाधान फ़ाइल में सभी परीक्षण चलाने के लिए nunit-console.exe इस्तेमाल करने की कोशिश:रनिंग nunit-सांत्वना System.IO.FileLoadException

nunit-console.exe MyProject.sln

मैं निम्नलिखित अपवाद प्राप्त करें (नीचे दिखाया गया है)। हालांकि जब मेरे फ़ोल्डर संरचना में किसी भी परियोजना पर कंसोल धावक चलाते हैं, तो धावक ठीक काम करता है और मुझे कभी भी निम्नलिखित अपवाद नहीं देता है। मैं भी निश्चित रूप से निश्चित हूं कि ननिट लाइब्रेरी का संस्करण जो मैं जोड़ रहा हूं वह वही है जो मैं उपयोग कर रहा हूं। साथ ही, मेरा समाधान किसी भी प्रोजेक्ट का संदर्भ नहीं देता है जो मेरी .sln फ़ाइल वाली निर्देशिका संरचना से बाहर है।

क्या किसी के पास कोई सुराग है जो मैं कर सकता हूं !? :(

धन्यवाद! फिल

NUnit version 2.5.10.11092 
Copyright (C) 2002-2009 Charlie Poole. 
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov. 
Copyright (C) 2000-2002 Philip Craig. 
All Rights Reserved. 

Runtime Environment - 
    OS Version: Microsoft Windows NT 6.1.7601 Service Pack 1 
    CLR Version: 4.0.30319.1 (Net 4.0) 

ProcessModel: Default DomainUsage: Default 
Execution Runtime: net-4.0 
Unhandled Exception: 
System.IO.FileLoadException: Could not load file or assembly 'nunit.framework, Version=2.5.10.11092, Culture=neutral, Pu 
blicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The located assembly's manifest definition does not match the 
assembly reference. (Exception from HRESULT: 0x80131040) 
File name: 'nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' 

Server stack trace: 
    at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, 
IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) 
    at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInsta 
ntiationContext, RuntimeTypeHandle[] methodInstantiationContext) 
    at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHa 
ndle[] methodInstantiationContext) 
    at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethod 
Arguments) 
    at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope 
, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilte 
rType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMeth 
odInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) 
    at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, 
Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecorate 
dTargetSecurityTransparent) 
    at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit) 
    at NUnit.Core.CoreExtensions.InstallAdhocExtensions(Assembly assembly) 
    at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path) 
    at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites) 
    at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites) 
    at NUnit.Core.TestSuiteBuilder.Build(TestPackage package) 
    at NUnit.Core.SimpleTestRunner.Load(TestPackage package) 
    at NUnit.Core.ProxyTestRunner.Load(TestPackage package) 
    at NUnit.Core.ProxyTestRunner.Load(TestPackage package) 
    at NUnit.Core.RemoteTestRunner.Load(TestPackage package) 
    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, 
Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) 
    at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExec 
uteInContext) 

Exception rethrown at [0]: 
    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) 
    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 
    at NUnit.Core.TestRunner.Load(TestPackage package) 
    at NUnit.Util.TestDomain.Load(TestPackage package) 
    at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options) 
    at NUnit.ConsoleRunner.Runner.Main(String[] args) 

WRN: Assembly binding logging is turned OFF. 
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 

Note: There is some performance penalty associated with assembly bind failure logging. 
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 

उत्तर

4

क्या विधानसभा लोड करने के लिए विफल हो रहा है देखने के लिए Fusion Log Viewer का उपयोग करें। यह आप न केवल बताना चाहिए क्या फ़ाइल उस पर विफल हो रहा है, लेकिन जहां यह है कि की तलाश करने की कोशिश की फ़ाइल।

+0

आह! यह उपकरण जादू है! धन्यवाद पेड्रो :) यह पता चला है कि हम एक तृतीय पक्ष सॉफ़्टवेयर का उपयोग कर रहे हैं जिसमें एक नुनिट डीएल शामिल था जो हमारे मुकाबले एक अलग संस्करण था। और नूनिट हमारे खोजने से पहले उस डीएल को ढूंढ रहा था। चूंकि हमें इस तृतीय पक्ष सॉफ़्टवेयर पर नूनिट चलाने की आवश्यकता नहीं है, हमने अभी डीएल के अपने संस्करण को हटा दिया है। मुझे यह जानने में दिलचस्पी होगी कि इसके आसपास एक बेहतर तरीका है, लेकिन अभी के लिए, मैं सामग्री हूं। – Phil

2

मेरे मामले nunit-console.exe में web|app.config से विधानसभा पुनर्निर्देशन सम्मान नहीं किया। जब तक आप प्रदान /domain=multiple

मेरी समस्या: EntityFrameworkTesting.Moq -> अनुरोध Moq, संस्करण = 4.2.1409.1722

मेरे पास पहले से ही एक नई असेंबली संदर्भित थी।

मेरे लिए समाधान/domain=multiple पैरामीटर जोड़ने का था। देख NUnit docs

तो मैं चलाएँ:

D:\tools\NUnit-2.6.4\bin\nunit-console.exe %SOLUTION_PATH%\Project.sln /config:Release /framework:net-4.0 /domain=multiple /xml=nunit-result.xml 
संबंधित मुद्दे