由于TeamCity构建测试程序集错误,因此无法运行MSpec测试 [英] Unable to run MSpec test due to the fact that TeamCity is building test assembly wrong

查看:113
本文介绍了由于TeamCity构建测试程序集错误,因此无法运行MSpec测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在构建解决方案之后运行MSpec测试.因此,我的MSBuild脚本设置如下:

I am trying to run a MSpec test following the build of my solution. So, I've got my MSBuild script set up as follows:

<?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
      <Target Name="Build">
        <MSBuild Projects="../MyApplication.Web.sln" />
        <Message Text="Building solution" Importance="high" />
      </Target>

      <Target Name="TeamCity" DependsOnTargets="Build">
        <Message Text="Before executing MSpec command" Importance="high" />
        <Exec Command="mspec.exe ..\Hosts\MyApplication.Hosts.Web.Specs\bin\MyApplication.Hosts.Web.Specs.dll --teamcity" />
        <Message Text="Running MSpec" Importance="high" />  
      </Target>
    </Project>

然后我将"TeamCity"称为TeamCity的目标.当命令

I then call "TeamCity" as my target in TeamCity. When the command

"mspec.exe .. \ Hosts \ MyApplication.Hosts.Web.Specs \ bin \ MyApplication.Hosts.Web.Specs.dll --teamcity"

"mspec.exe ..\Hosts\MyApplication.Hosts.Web.Specs\bin\MyApplication.Hosts.Web.Specs.dll --teamcity"

被执行,出现以下错误:

is executed, I get the following error:

C:\ TeamCity \ buildAgent \ work \ 117e3aa3bb76aad0 \ Build> mspec .. \ Hosts \ Application.Hos ts.Web.Specs \ bin \ Application.Hosts.Web.Specs.dll 无法加载文件或程序集'file:///C:\ TeamCity \ buildAgent \ work \ 117e3aa3bb7 6aad0 \ Hosts \ Application.Hosts.Web.Specs \ bin \ Application.Hosts.Web.Specs.dll'或打开 e的依存关系.试图用不正确的f加载程序 Ormat.

C:\TeamCity\buildAgent\work\117e3aa3bb76aad0\Build>mspec ..\Hosts\Application.Hos ts.Web.Specs\bin\Application.Hosts.Web.Specs.dll Could not load file or assembly 'file:///C:\TeamCity\buildAgent\work\117e3aa3bb7 6aad0\Hosts\Application.Hosts.Web.Specs\bin\Application.Hosts.Web.Specs.dll' or on e of its dependencies. An attempt was made to load a program with an incorrect f ormat.

经过一些调查,我发现本地计算机和构建服务器上的"MyApplication.Hosts.Web.Specs.dll"(尽管均为15kb)具有不同的md5校验和.这可以解释为什么执行MSpec测试会导致错误.实际上,如果我将dll从本地计算机复制到构建服务器,则将运行测试.

After doing some investigation, I found out that the "MyApplication.Hosts.Web.Specs.dll" on my local machine and the build server, although both 15kb, had different md5 checksums. That might explain why the execution of the MSpec test would cause errors. In fact, if I copy the dll from my local machine to the build server, the test will run.

所以我的问题是,是否有人遇到过同一问题,即正在严重"构建程序集的建筑?

So my question is whether someone else has come across this same issue of the builiding of assemblies being build "badly"?

-编辑- 我在本地将解决方案构建为64位应用程序,但在TeamCity中,我将其构建为32位(x86).可能是问题所在吗?

-EDIT- Locally I'm building the solution as a 64 bit application but in TeamCity, I'm building it as 32 bits (x86). Could that be the problem?

PS:我曾尝试在TeamCity中将其构建为64位应用程序,但我遇到了其他错误,但我暂时不予理会.但是,出于完整性考虑,它是:

PS:I tried building it as a 64 bit application in TeamCity but I get other errors which I would rather ignore for the moment. However, for completeness sake here it is:

Client\ProdMaster.SLCharts\ProdMaster.SLCharts.csproj
[15:11:22]: [Client\ProdMaster.SLCharts\ProdMaster.SLCharts.csproj] GetFrameworkPaths
[15:11:22]: [GetFrameworkPaths] ValidateSilverlightFrameworkPaths
[15:11:22]: [ValidateSilverlightFrameworkPaths] C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v4.0\Microsoft.Silverlight.Common.targets(104, 9): The Silverlight 4 SDK is not installed.

推荐答案

David,

  • 您是哪个版本的MSpec 跑步?如果您仍然使用0.3.0.0,我 鼓励您切换到最 最新的0.4.9.0版本.这个版本 也包含mspec.exe(AnyCPU) 作为mspec-x86.exe(x86).你应该 使用与您的构建匹配的可执行文件 环境/体系结构.

  • Which version of MSpec are you running? If you're still on 0.3.0.0 I encourage you to switch to the most recent 0.4.9.0 build. This build contains mspec.exe (AnyCPU) as well as mspec-x86.exe (x86). You should use the executable matching your build environment/architecture.

请您跟踪一下程序集 与Fustion Log Viewer绑定- 它是Windows SDK的一部分.这 错误消息试图 加载不正确的程序 格式."表示MSpec能够 查找规范DLL,但定位 架构之间不匹配 MSpec可执行文件和规范 组装.

Can you please trace the assembly binding with Fustion Log Viewer - it's part of the Windows SDK. The error message "An attempt was made to load a program with an incorrect format." indicates that MSpec is able to find the spec DLL, but target architectures do not match between the MSpec executable and and spec assembly.

这篇关于由于TeamCity构建测试程序集错误,因此无法运行MSpec测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆