c# - sgen.exe x64 .net c# 失败,出现 "assembly with an incorrect format"

标签 c# visual-studio 64-bit sgen

我有 ws2008 x64 和 vs2008。

当我将 vs 设置为 x64(因为我有 64 位 dll)并运行编译时,sgen 说

试图加载格式不正确的程序集

VS takse sgen 来自 C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\

我认为它应该从 C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\x64\

当我使用 64 位版本的 sgen 并将其放入 C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\(替换 32 位版本)时。我能够编译。

vs下sgen应该怎么指向正确的版本

我能否以某种方式为一个项目配置 solutinon 平台以指向正确的 sgen(对于 x86 到 32 位和 x64 到 64 位 sgen 版本)?

最佳答案

这对您有帮助吗?看看他所在的部分 uses sgen as a post build :

As a consequence you need to add the SGen command as a custom post-build event on the Build Events tab of your VS project properties:

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sgen.exe" /force /assembly:"$(TargetPath)" /compiler:/keycontainer:VS_KEY_5EFB7881D71082EDCF85DBBFCD748B9A /compiler:/delaysign-

关于c# - sgen.exe x64 .net c# 失败,出现 "assembly with an incorrect format",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1980278/

相关文章:

c# - 如何将 Xamarin.Forms 与 Xamarin.Auth 结合使用来存储和检索帐户对象

c# - Thread.Join() 需要帮助

c# - asp mvc View 模型验证属性

javascript - 使用 Razor 维护 @section 标记内的 Javascript 代码突出显示

visual-studio - 如何在 Visual Studio 中为当前选择交换剪贴板内容

c++ - 如何从 DLL 的导出函数中获取 std::string?

php - 设置 PHP 以使整数为 64 位的具体细节是什么?

c++ - 从 32 位进程调用 64 位 dll 上的 LoadLibrary

c# - 通过套接字发送的另一端已损坏

c++ - (C++) 即使我在 Visual Studio 中按 CTRL + F5,控制台窗口也会立即关闭