我最近将一个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时遇到了相同的错误,但我无法弄清问题出在哪里。有任何想法吗?