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:试图加载格式不正确的程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

MSBuild cannot find a reference(MSBuild 找不到参考)
The reference assemblies for framework .NETCore, Version=v5.0 were not found(未找到框架 .NETCore,Version=v5.0 的参考程序集)
quot;File has a different computed hash than specified in manifestquot; error when signing the EXE(“文件的计算哈希值与清单中指定的不同签署EXE时出错)
Good-practices: How to reuse .csproj and .sln files to create your MSBuild script for CI?(良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 MSBuild 脚本?)
Run an MSBuild target only if project is actually built(仅在实际构建项目时运行 MSBuild 目标)
MS-Build BeforeBuild not firing(MS-Build BeforeBuild 未触发)