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

SGEN: An attempt was made to load an assembly with an incorrect format(SGEN:试图加载格式不正确的程序集)

本文介绍了SGEN:试图加载格式不正确的程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可以在我的本地机器上正常构建的项目,但是,当我让 TFS 构建它时,我收到以下错误 -

I have a project that can build fine on my local machine, however, when I get TFS to build it, I receive the following error -

SGEN:尝试加载格式不正确的程序集:

SGEN: An attempt was made to load an assembly with an incorrect format:

在阅读了此处有关此主题的许多其他帖子后,大多数人只是说我需要将构建类型更改为 x86 或 Any CPU,而不是 x64,但在尝试了无数组合之后,这不是解决方案.我的程序也是一个windows服务,所以设置App Pool允许32位应用(其他人建议)也不是解决办法.

After reading through many other posts here on this topic, most people just say I need to change the build type to either x86 or Any CPU, rather than x64, but after trying countless combinations, this was not the solution. My program is also a windows service, so setting the App Pool to allow 32 bit applications (as suggested by others) is also not the solution.

推荐答案

这个页面终于解决了我的问题 - http://aplocher.wordpress.com/2012/10/12/sgen-an-attempt-was-made-to-load-an-assembly-with-an-incorrect-format-tfs-2010/

My problem was finally solved by this page - http://aplocher.wordpress.com/2012/10/12/sgen-an-attempt-was-made-to-load-an-assembly-with-an-incorrect-format-tfs-2010/

以防万一该页面将来消失,以下是所涉及的步骤 -

Just in case that page ever disappears in the future, here are the steps involved -

  1. 在团队资源管理器中,右键单击您的构建定义并选择打开进程文件位置
  2. 双击选中的 XAML 文件
  3. 在设计器中,选择名为 Sequence 的容器(这是围绕其他所有内容的顶级容器).
  4. 在 Arguments 列表(通常位于底部)中,将 MSBuildPlatform 从 Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.Auto 更改为 Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.X86.
  5. 保存并关闭文件.
  6. 将文件重新检入 TFS 并再次尝试构建.

这篇关于SGEN:试图加载格式不正确的程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:SGEN:试图加载格式不正确的程序集

基础教程推荐