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

2023-09-03 11:56:56 作者:爱ペ是见光死

我有一个可以但是构建罚款我的本地机器,一个项目,当我得到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或任何CPU,而不是64位,但在尝试了无数的组合后,这也不是办法。我的程序也是一个窗口服务,因此设置应用程序池,让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.word$p$pss.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 -

在团队资源管理器中,右键单击您的生成定义,然后选择打开进程文件位置 双击点击XAML文件中选定 在设计,选择容器叫做序列(这是绕着一切的顶层容器)。 在参数列表(通常在底部),从Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.Auto改变MSBuildPlatform到Microsoft.TeamFoundation.Build.Workflow.Activities.ToolPlatform.X86。 保存并关闭该文件。 检查文件放回到TFS并再次尝试构建。