请帮忙,我已经尝试了所有我能想到的方法来解决这个问题。
在您回复之前,请注意:
我已经从StackOverflow.com和其他网站上做了我能做的一切。例如但不限于: 将构建配置从"Any CPU"更改为"x64"甚至"x86"。还将目标构建从.NET 4.0更改为.NET 3.5(这行不通,因为我使用了需要.NET 4.0的System.Windows.Interactivity)。所以我被困在.NET 4.0中。因此,请不要给我提供一个让我这样做的答案,因为我已经尝试过各种组合。
我在VS2013中有一个名为TimersXP的项目,它是CodePlex.com上的一个开源项目: https://timersxp.codeplex.com/
它编译时没有任何错误,但是我遇到了运行时异常: System.BadImageFormatException was unhandled Message: An unhandled exception of type 'System.BadImageFormatException' occurred in Unknown Module. Additional information: Could not load file or assembly 'TimersXP.exe' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
稍微说一下历史,这个项目最初是.NET 3.5,但当我发现我必须添加System.Windows.Interactivity并且必须支持.NET 4.0时,我增加了版本号。
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.0\Libraries\System.Windows.Interactivity.dll</HintPath>
<Private>False</Private>
</Reference>
是的,我知道它显示的是版本4.5.0.0,我也尝试过不同的组合,除非我错过了一些意料之外的组合方法。
这是开源的,所以整个项目的代码都可以获得,有人能帮帮我吗?我已经没有其他想法了。
也许在App.config文件中可以找到这个版本号?
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
我不想只是遍历所有代码并更改每处提到版本号的地方为3.5或4.0或4.5。那似乎不是一个很好的主意。
通常,一旦我看到它,我可能会想打自己的脸!
corflags
在所有参与的程序集上,您很快就会看到哪一个格式不正确。 - T.S.