実行可能ファイルは、.NET 3.5 に対してコンパイルされています。私たちはソース コードを所有していないため、再コンパイルすることはできません。したがって、.NET 4.0 で実行するために、このページに従って、これを構成ファイルに追加しました。
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
ここで、構成ファイルに関連していると思われる別のエラーが発生します。
かなり複雑な構成ファイルについて、.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>