2012-02-11 14 views
8

voglio eseguire alcuni test di accettazione mediante Watin ed ottengo il seguente errore quando provo ad aprire il montaggio di prova in NUnit GUI:NUnit FileNotFoundException: System.Configuration

System.IO.FileNotFoundException: Impossibile caricamento file o assemblaggio 'System.Configuration, Versione = 4.0.0.0, Cultura = neutra, PublicKeyToken = b03f5f7f11d50a3a' o una delle sue dipendenze. Il sistema non riesce a trovare il file specificato.

Dettagli eccezione:

System.IO.FileNotFoundException... 

Server stack trace: 
    at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) 
    at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 
    at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 
    at System.Reflection.Assembly.Load(String assemblyString) 
    at System.UnitySerializationHolder.GetRealObject(StreamingContext context) 
    at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder) 
    at System.Runtime.Serialization.ObjectManager.DoFixups() 
    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) 
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage) 
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage methodCallMessage) 
    at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg) 

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.Core.ProxyTestRunner.Load(TestPackage package) 
    at NUnit.Util.ProcessRunner.Load(TestPackage package) 
    at NUnit.Util.TestLoader.LoadTest(String testName) 

tutto ha funzionato bene, prima ho aggiunto un riferimento a System.Configuration per leggere l'URL di base dal App.config

risposta

14

Sembra che il problema era l'ordine delle sezioni nel file App.config.

Per prima cosa ho aggiunto la sezione appSettings, ma dopo averla spostata tutto ha iniziato a funzionare come dovrebbe di nuovo.

Ecco il contenuto App.config:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <configSections> 
     <sectionGroup name="NUnit"> 
      <section name="TestRunner" type="System.Configuration.NameValueSectionHandler"/> 
     </sectionGroup> 
    </configSections> 

    <NUnit> 
     <TestRunner> 
      <add key="ApartmentState" value="STA"/> 
     </TestRunner> 
    </NUnit> 

    <appSettings> 
     <add key="BaseUrl" value="http://localhost/Test"/> 
    </appSettings> 
</configuration> 
+1

* sigh * grazie .. –

+3

avevo bisogno di cambiare il tipo di seguito per farlo lavorare: type = "System.Configuration.NameValueSectionHandler, Sistema, Versione = 4.0.0.0, Cultura = neutrale, PublicKeyToken = b77a5c561934e089 " – rfcdejong

Problemi correlati