持续集成,异常:nunit-console-x86.exe System.BadImageFormatException: 未能加载文件或程序集

来源:互联网 发布:开网店需要哪些软件 编辑:程序博客网 时间:2024/04/27 22:25

1  环境:

vs2010, NUnit2.5.5,CruiseControl.NET

2  症状:

Execution Runtime: net-2.0

Unhandled Exception:

System.BadImageFormatException: 未能加载文件或程序集“F:\SourceCode\FastQuery20161230\FastQueryTest\bin\Debug\FastQueryTest.dll”或它的某一个依赖项。生成此程序集的运行时比当前加载的运行时新,无法加载此程序集。

文件名:“F:\SourceCode\FastQuery20161230\FastQueryTest\bin\Debug\FastQueryTest.dll”

3  诊断:

首先需要移除项目中黄色的感叹号。在vs2010控制台使用如下命令

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exeF:\SourceCode\FastQuery20161230\FastQuery.sln,生成了dll文件。还是在vs2010控制台,再用nunit-console-x86.exe执行生成的dll抛出上面异常。

4  解决方案:

看来是版本问题。从http://download.csdn.net/download/linkedin_26236961/8464073下载Nunit-2.6.4.msi ,本地安装包位置:\\vmware-host\SharedFolders\F\软件安装包\单元测试\NUnit-2.6.4.msi

安装位置:

D:\NUnit 2.6.4\bin

再执行。

D:\Program Files (x86)\CruiseControl.NET\server下的配置文件ccnet.config改成如下:

<executable>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>

<nunitpath="D:\NUnit2.6.4\bin\nunit-console-x86.exe">

ccnet.config配置文件内容:

<cruisecontrol>

   <!-- This is yourCruiseControl.NET Server Configuration file. Add your projects below!-->

 <projectname="FastQuery" >

   <workingDirectory>E:\WorkSpace\SummerCourtyard\CVComponent20161213</workingDirectory>

   <artifactDirectory>D:\Program Files(x86)\CruiseControl.NET\artifactDirectory</artifactDirectory>

   <category>Library Category</category>

   <webURL>http://localhost/ccnet/server/local/project/FastQuery/ViewProjectReport.aspx</webURL>

   <modificationDelaySeconds>2</modificationDelaySeconds>

   <triggers>

     <intervalTriggerseconds="60"/>

   </triggers>

   <!--statetype="yourStateManagerType" ..=""/-->

   <sourcecontroltype='svn'>

     <!--url-->

     <trunkUrl>https://win-9ris1mc6f8k/svn/SmartCode/SelfDefinitionQueryCMP</trunkUrl>

     <!--svn-->

     <executable>D:\Program Files\VisualSVN Server\bin\svn.exe</executable>

     <workingDirectory>F:\SourceCode\FastQuery20161230</workingDirectory>

     <!--svn-->

     <username>cyberzhaohy</username>

     <!--svn-->

     <password>2319474</password>

     <autoGetSource>true</autoGetSource>

   </sourcecontrol>

   <!--labellertype="dateLabeller"/-->

   <!--prebuild>

            <yourFirstPrebuildTask..=""/>

            <yourOtherPrebuildTask..=""/>

        </prebuild-->

   <tasks>

     <!---->

     <!--Pass-->

      <msbuild>

      <!--msbuild-->

       <executable>C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>

          <!---->

       <workingDirectory>F:\SourceCode\FastQuery20161230</workingDirectory>

       <!--projectworkingDirectory,MSBuild-->

       <projectFile>FastQuery.sln</projectFile>

       <!---->

       <buildArgs>/p:Configuration=Debug /v:diag</buildArgs>

       <!--<buildArgs>/t:Build/p:Configuration=Release</buildArgs>-->

       <!---->

       <targets>Build</targets>

       <!---->

       <timeout>900</timeout>

       <!--workingDirectory-->

       <logger>D:\Program Files(x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>

     </msbuild>

     <nunitpath="D:\NUnit 2.6.4\bin\nunit-console-x86.exe">

       <assemblies>

          <assembly>F:\SourceCode\FastQuery20161230\FastQueryTest\bin\Debug\FastQueryTest.dll</assembly>

       </assemblies>

     </nunit>

   </tasks>

   <publishers>

     <xmllogger />

   </publishers>

   <externalLinks>

     <externalLinkname="google"url="http://somewhere/"/>

     <externalLinkname="My Other Link"url="http://somewhere.else/"/>

   </externalLinks>

 </project>

</cruisecontrol>

现在持续集成已经没有问题。

NUnit 3.0之后每次发布不见得都有gui了。

参考网址:

http://www.th7.cn/Program/net/201312/165949.shtml




0 0
原创粉丝点击