Reputation: 1056
Our executable was compiled against .NET 3.5. We don't own the source code and so can't recompile it. So, to get it to run with .NET 4.0, we added this to the config file, per this page:
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
Now, we get a different error that seems related to the configuration file:
I suspected that there is something .NET 4.0 doesn't like about our fairly complex configuration file. To verify this, I did the following:
I began to simplify the complex configuration file to narrow down the issue, and I got it down this far so far. Does anyone know what the problem could be?
<?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>
Upvotes: 0
Views: 489
Reputation: 1056
Turns out the problem was that configSections has to be the first child of configuration.
I figured this out by putting the complex configuration into the blank WinForms config file, reading the configuration and looking at the details of the exception that was thrown.
Upvotes: 1