2013-02-13 63 views
0

我們的可執行文件是針對.NET 3.5編譯的。我們不擁有源代碼,因此不能重新編譯它。因此,要獲得它與.NET 4.0上運行,我們已將此添加到配置文件,每this page從.NET 3.5升級到.NET 4.0:是否存在配置文件中斷更改?

<startup> 
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /> 
</startup> 

現在,我們得到了似乎與配置文件不同的錯誤:

enter image description here

我懷疑有一些東西.NET 4.0不喜歡我們相當複雜的配置文件。爲了驗證這一點,我做了以下內容:

  • 創建一個空白.NET 3.5的WinForms EXE
  • 添加到配置的supportedRuntime如上圖
  • 驗證它使用跑上了.NET 4.0的DLL進程瀏覽器。

我開始簡化複雜的配置文件來縮小問題的範圍,到目前爲止我已經把它解決了。有誰知道是什麼問題?

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <startup> 
     <supportedRuntime version="v4.0" /> 
    </startup> 
    <configSections> 
    <sectionGroup name="spring"> 
     <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core" /> 
     <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" /> 
    </sectionGroup> 
    </configSections> 
    <spring> 
    <context type="Spring.Context.Support.XmlApplicationContext, Spring.Core" name="Default"> 
     <resource uri="config://spring/objects" /> 
    </context> 
    <objects xmlns="http://www.springframework.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd" default-lazy-init="true">  
     <object id="Foo1" type="Foo.Bar1, Foo.Bar"> 
     <description>lorem ipsum</description> 
     </object> 
     <object id="Foo2" singleton="false" type="Foo.Bar2, Foo.Bar"> 
     <description>lorem ipsum</description> 
     </object> 
     <object id="Foo3" singleton="false" type="Foo.Bar3, Foo.Bar">  
     <description>lorem ipsum</description> 
     </object> 
     <object id="Foo4" type="Foo.Bar4, Foo.Bar">    
     <description>lorem ipsum</description> 
     </object> 
     <object id="Foo5" type="Foo.Bar5, Foo.Bar">    
     <description> 
      lorem ipsum 
     </description> 
     <constructor-arg> 
      <list element-type="Foo.IBar5, Foo.Bar"> 
      <ref object="Foo4" /> 
      </list> 
     </constructor-arg> 
     </object> 
    </objects> 
    </spring> 

</configuration> 
+0

[解密.NET clr20r3異常參數P1..P10]的可能重複(http://stackoverflow.com/questions/4052770/deciphering-the-net-clr20r3-exception-parameters-p1-p10) – 2013-02-13 22:57:19

+0

是那些XML命名空間的東西真的需要Spring嗎?我懷疑這可能是問題所在。刪除它們並嘗試。 – leppie 2013-02-14 06:02:58

回答

1

原來,問題是,configSections必須配置的第一個孩子。

我想通過將複雜的配置放入空白的WinForms配置文件,讀取配置並查看拋出的異常的詳細信息。

相關問題