我最近刚刚将 VS2008/.NET 3.5 SP1 项目升级到 VS2010 和 .NET 4。我有一个构建后事件,它调用 SGEN 来生成 XmlSerializers 程序集。
每当我尝试运行它时,都会出现以下错误。
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\sgen.exe" /debug /force /verbose /c:"platform:x86" "C:\path\to\SomeAssembly.dll"
Microsoft (R) Xml Serialization support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright (C) Microsoft Corporation. All rights reserved.
Error: An attempt was made to load an assembly with an incorrect format: c:\path\to\someassembly.dll.
- Could not load file or assembly 'file:///c:\path\to\someassembly.dll'
or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
If you would like more help, please type "sgen /?".
我从命令行运行 SGEN 时遇到同样的错误,但我无法弄清楚问题所在。有任何想法吗?