在 CruiseControl.NET 中运行 NUnit 任务总是抛出错误
所以我对 cc.net 还很陌生,但到目前为止我很喜欢它。我有最新的 SVN、MSBuild 构建,但是当谈到运行我的单元测试时,kablooey。
我尝试了有关修复 GAC 中的引用的建议修复,但没有解决任何问题。我什至卸载/重新安装了 NUnit,但仍然没有成功。另外,我的测试最初引用了 NUUnit 2.46,但现在我引用了我安装的相同版本 2.5.2。我正在运行 CruiseControl.NET 1.4.4.83。
目前我在我的开发机器上运行 cc.net,它是 WinXP Pro SP3,安装了 .NET 2.0 SP1 和 3.5 SP1。我不使用 VS.NET 进行构建,仅供参考,在计算机上安装了 VS.NET 2005 和 2008 专业版。
nunit-console.exe 从命令行运行良好,那么怎么了?
这是我的配置文件:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<project>
<name>STAR Trunk</name>
<triggers>
<intervalTrigger name="continuous" seconds="450" buildCondition="ForceBuild" initialSeconds="120"/>
</triggers>
<sourcecontrol type="multi">
<sourceControls>
<svn>
<trunkUrl>svn://myServerPath1</trunkUrl>
<workingDirectory>c:\MyPath1</workingDirectory>
<username>username</username>
<password>password</password>
</svn>
<svn>
<trunkUrl>svn://myServerPath2</trunkUrl>
<workingDirectory>c:\MyPath2</workingDirectory>
<username>username</username>
<password>password</password>
</svn>
</sourceControls>
</sourcecontrol>
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe</executable>
<workingDirectory>c:\MyPath</workingDirectory>
<projectFile>c:\MyPath\solution.sln</projectFile>
<buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
<targets>Clean;Rebuild</targets>
<timeout>1200</timeout>
</msbuild>
<nunit>
<path>C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe</path>
<assemblies>
<assembly>c:\MyTestsPath\bin\Assembly1.dll</assembly>
<assembly>c:\MyTestsPath\bin\Assembly2.dll</assembly>
<assembly>c:\MyTestsPath\bin\Assemblyn.dll</assembly>
<assembly>c:\MyTestsPath\bin\nunit.framework.dll</assembly>
</assemblies>
</nunit>
</tasks>
</project>
</cruisecontrol>
cc.net 服务器日志给出了以下内容:
2009-11-04 11:47:53,841 [STAR Trunk:DEBUG] Running unit tests: C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe /xml="C:\Program Files\CruiseControl.NET\server\STAR Trunk\Artifacts\nunit-results.xml" /nologo D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Acuity.Diagnostics.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Acuity.UnitTests.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\AjaxControlToolkit.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\AutoSproc.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Framework.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Interop.HDSECOMPRESSION.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\MetaBuilders.WebControls.ConfirmedButton.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\MetaBuilders.WebControls.ExpandingPanel.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\nunit.framework.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Star4.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\StarCore.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\StarReport.Lib.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\WebControls.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\webdev.webhost.dll
2009-11-04 11:47:53,888 [STAR Trunk:DEBUG] Starting process [C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] in working directory [C:\Program Files\CruiseControl.NET\server\STAR Trunk\WorkingDirectory] with arguments [/xml="C:\Program Files\CruiseControl.NET\server\STAR Trunk\Artifacts\nunit-results.xml" /nologo D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Acuity.Diagnostics.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Acuity.UnitTests.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\AjaxControlToolkit.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\AutoSproc.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Framework.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Interop.HDSECOMPRESSION.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\MetaBuilders.WebControls.ConfirmedButton.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\MetaBuilders.WebControls.ExpandingPanel.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\nunit.framework.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Star4.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\StarCore.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\StarReport.Lib.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\WebControls.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\webdev.webhost.dll]
2009-11-04 11:47:55,326 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] ProcessModel: Default DomainUsage: Multiple
2009-11-04 11:47:55,373 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] Execution Runtime: net-2.0.50727.3603
2009-11-04 11:47:55,498 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] Unhandled Exception:
2009-11-04 11:47:55,498 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] System.IO.FileLoadException: Could not load file or assembly 'file:///C:/Program Files/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.DLL' or one of its dependencies. Incorrect function. (Exception from HRESULT: 0x80070001)
2009-11-04 11:47:55,498 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] File name: 'file:///C:/Program Files/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.DLL'
2009-11-04 11:47:55,498 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
2009-11-04 11:47:55,498 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
2009-11-04 11:47:55,513 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
2009-11-04 11:47:55,513 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
2009-11-04 11:47:55,513 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence)
2009-11-04 11:47:55,513 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Activator.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
2009-11-04 11:47:55,513 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
2009-11-04 11:47:55,513 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
2009-11-04 11:47:55,529 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
2009-11-04 11:47:55,529 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Activator.CreateInstanceFrom(AppDomain domain, String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
2009-11-04 11:47:55,529 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at NUnit.Core.DomainInitializer.CreateInstance(AppDomain targetDomain)
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at NUnit.Util.DomainManager.CreateDomain(TestPackage package)
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at NUnit.Util.TestDomain.Load(TestPackage package)
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at NUnit.Util.AggregatingTestRunner.Load(TestPackage package)
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at NUnit.ConsoleRunner.Runner.Main(String[] args)
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe]
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe]
2009-11-04 11:47:55,544 [STAR Trunk:INFO] Task execution failed
2009-11-04 11:47:55,544 [STAR Trunk:INFO] Task output: ProcessModel: Default DomainUsage: Multiple
Execution Runtime: net-2.0.50727.3603
Unhandled Exception:
System.IO.FileLoadException: Could not load file or assembly 'file:///C:/Program Files/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.DLL' or one of its dependencies. Incorrect function. (Exception from HRESULT: 0x80070001)
File name: 'file:///C:/Program Files/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.DLL'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence)
at System.Activator.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.Activator.CreateInstanceFrom(AppDomain domain, String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at NUnit.Core.DomainInitializer.CreateInstance(AppDomain targetDomain)
at NUnit.Util.DomainManager.CreateDomain(TestPackage package)
at NUnit.Util.TestDomain.Load(TestPackage package)
at NUnit.Util.AggregatingTestRunner.Load(TestPackage package)
at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
at NUnit.ConsoleRunner.Runner.Main(String[] args)
2009-11-04 11:47:55,544 [STAR Trunk:WARN] NUnit test output file C:\Program Files\CruiseControl.NET\server\STAR Trunk\Artifacts\nunit-results.xml was not created
2009-11-04 11:47:56,263 [STAR Trunk:DEBUG] Supplied output is not valid xml. Writing as CDATA
2009-11-04 11:47:56,263 [STAR Trunk:DEBUG] Output: ProcessModel: Default DomainUsage: Multiple
Execution Runtime: net-2.0.50727.3603
Unhandled Exception:
System.IO.FileLoadException: Could not load file or assembly 'file:///C:/Program Files/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.DLL' or one of its dependencies. Incorrect function. (Exception from HRESULT: 0x80070001)
File name: 'file:///C:/Program Files/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.DLL'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence)
at System.Activator.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.Activator.CreateInstanceFrom(AppDomain domain, String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at NUnit.Core.DomainInitializer.CreateInstance(AppDomain targetDomain)
at NUnit.Util.DomainManager.CreateDomain(TestPackage package)
at NUnit.Util.TestDomain.Load(TestPackage package)
at NUnit.Util.AggregatingTestRunner.Load(TestPackage package)
at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
at NUnit.ConsoleRunner.Runner.Main(String[] args)
2009-11-04 11:47:56,263 [STAR Trunk:DEBUG] Exception: System.Xml.XmlException: An error occurred while parsing EntityName. Line 6, position 146.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, Int32 lineNo, Int32 linePos)
at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)
at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
at System.Xml.XmlTextReaderImpl.ReadValueChunk(Char[] buffer, Int32 index, Int32 count)
at System.Xml.XmlWriter.WriteNode(XmlReader reader, Boolean defattr)
at ThoughtWorks.CruiseControl.Core.Util.XmlFragmentWriter.WriteNode(XmlReader reader, Boolean defattr)
at ThoughtWorks.CruiseControl.Core.Util.XmlFragmentWriter.WriteNode(String xml)
2009-11-04 11:47:56,263 [STAR Trunk:INFO] Integration complete: Failure - 11/4/2009 11:47:55 AM
在 mfeingold 在下面发布有关融合日志之后,这就是我得到的内容:
*** Assembly Binder Log Entry (11/7/2009 @ 10:26:46 PM) ***
The operation failed.
Bind result: hr = 0x80070001. Incorrect function.
Assembly manager loaded from: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files\NUnit 2.4.6\bin\nunit-console.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = NT AUTHORITY\SYSTEM
LOG: Where-ref bind. Location = C:/Program Files/NUnit 2.4.6/bin/nunit.core.DLL
LOG: Appbase = file:///D:/dev/automatedTrunk/Star/Acuity.UnitTests/bin
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = C:\WINDOWS\TEMP\nunit20\ShadowCopyCache\2272_633932296067629930
LOG: AppName = Tests
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Download of application configuration file was attempted from file:///D:/dev/automatedTrunk/Star/Acuity.UnitTests/bin/Acuity.Diagnostics.dll.config.
So I'm fairly new to cc.net but like it so far. I have SVN getting latest, MSBuild building but when it comes to running my unit tests, kablooey.
I tried the fixes suggested about fixing references in the GAC, but that fixed nothing. I even uninstalled/reinstalled NUnit but still no luck. Also, my tests were initially referencing NUNit 2.46 but now I reference the same version I have installed 2.5.2. I'm running CruiseControl.NET 1.4.4.83.
Currently I'm running cc.net on my dev machine which is WinXP Pro SP3, with .NET 2.0 SP1 and 3.5 SP1 installed. I don't use VS.NET for the builds, but just for FYI VS.NET 2005 and 2008 Professional Edition are installed on the machine.
nunit-console.exe runs fine from the command line so what's up?
Here's my config file:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<project>
<name>STAR Trunk</name>
<triggers>
<intervalTrigger name="continuous" seconds="450" buildCondition="ForceBuild" initialSeconds="120"/>
</triggers>
<sourcecontrol type="multi">
<sourceControls>
<svn>
<trunkUrl>svn://myServerPath1</trunkUrl>
<workingDirectory>c:\MyPath1</workingDirectory>
<username>username</username>
<password>password</password>
</svn>
<svn>
<trunkUrl>svn://myServerPath2</trunkUrl>
<workingDirectory>c:\MyPath2</workingDirectory>
<username>username</username>
<password>password</password>
</svn>
</sourceControls>
</sourcecontrol>
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe</executable>
<workingDirectory>c:\MyPath</workingDirectory>
<projectFile>c:\MyPath\solution.sln</projectFile>
<buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
<targets>Clean;Rebuild</targets>
<timeout>1200</timeout>
</msbuild>
<nunit>
<path>C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe</path>
<assemblies>
<assembly>c:\MyTestsPath\bin\Assembly1.dll</assembly>
<assembly>c:\MyTestsPath\bin\Assembly2.dll</assembly>
<assembly>c:\MyTestsPath\bin\Assemblyn.dll</assembly>
<assembly>c:\MyTestsPath\bin\nunit.framework.dll</assembly>
</assemblies>
</nunit>
</tasks>
</project>
</cruisecontrol>
The cc.net server log gives this:
2009-11-04 11:47:53,841 [STAR Trunk:DEBUG] Running unit tests: C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe /xml="C:\Program Files\CruiseControl.NET\server\STAR Trunk\Artifacts\nunit-results.xml" /nologo D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Acuity.Diagnostics.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Acuity.UnitTests.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\AjaxControlToolkit.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\AutoSproc.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Framework.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Interop.HDSECOMPRESSION.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\MetaBuilders.WebControls.ConfirmedButton.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\MetaBuilders.WebControls.ExpandingPanel.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\nunit.framework.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Star4.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\StarCore.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\StarReport.Lib.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\WebControls.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\webdev.webhost.dll
2009-11-04 11:47:53,888 [STAR Trunk:DEBUG] Starting process [C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] in working directory [C:\Program Files\CruiseControl.NET\server\STAR Trunk\WorkingDirectory] with arguments [/xml="C:\Program Files\CruiseControl.NET\server\STAR Trunk\Artifacts\nunit-results.xml" /nologo D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Acuity.Diagnostics.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Acuity.UnitTests.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\AjaxControlToolkit.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\AutoSproc.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Framework.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Interop.HDSECOMPRESSION.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\MetaBuilders.WebControls.ConfirmedButton.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\MetaBuilders.WebControls.ExpandingPanel.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\nunit.framework.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\Star4.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\StarCore.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\StarReport.Lib.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\WebControls.dll D:\dev\automatedTrunk\Star\Acuity.UnitTests\bin\webdev.webhost.dll]
2009-11-04 11:47:55,326 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] ProcessModel: Default DomainUsage: Multiple
2009-11-04 11:47:55,373 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] Execution Runtime: net-2.0.50727.3603
2009-11-04 11:47:55,498 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] Unhandled Exception:
2009-11-04 11:47:55,498 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] System.IO.FileLoadException: Could not load file or assembly 'file:///C:/Program Files/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.DLL' or one of its dependencies. Incorrect function. (Exception from HRESULT: 0x80070001)
2009-11-04 11:47:55,498 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] File name: 'file:///C:/Program Files/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.DLL'
2009-11-04 11:47:55,498 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
2009-11-04 11:47:55,498 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
2009-11-04 11:47:55,513 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
2009-11-04 11:47:55,513 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
2009-11-04 11:47:55,513 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence)
2009-11-04 11:47:55,513 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Activator.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
2009-11-04 11:47:55,513 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
2009-11-04 11:47:55,513 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
2009-11-04 11:47:55,529 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
2009-11-04 11:47:55,529 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at System.Activator.CreateInstanceFrom(AppDomain domain, String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
2009-11-04 11:47:55,529 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at NUnit.Core.DomainInitializer.CreateInstance(AppDomain targetDomain)
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at NUnit.Util.DomainManager.CreateDomain(TestPackage package)
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at NUnit.Util.TestDomain.Load(TestPackage package)
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at NUnit.Util.AggregatingTestRunner.Load(TestPackage package)
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe] at NUnit.ConsoleRunner.Runner.Main(String[] args)
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe]
2009-11-04 11:47:55,544 [4088:DEBUG] [STAR Trunk C:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit-console.exe]
2009-11-04 11:47:55,544 [STAR Trunk:INFO] Task execution failed
2009-11-04 11:47:55,544 [STAR Trunk:INFO] Task output: ProcessModel: Default DomainUsage: Multiple
Execution Runtime: net-2.0.50727.3603
Unhandled Exception:
System.IO.FileLoadException: Could not load file or assembly 'file:///C:/Program Files/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.DLL' or one of its dependencies. Incorrect function. (Exception from HRESULT: 0x80070001)
File name: 'file:///C:/Program Files/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.DLL'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence)
at System.Activator.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.Activator.CreateInstanceFrom(AppDomain domain, String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at NUnit.Core.DomainInitializer.CreateInstance(AppDomain targetDomain)
at NUnit.Util.DomainManager.CreateDomain(TestPackage package)
at NUnit.Util.TestDomain.Load(TestPackage package)
at NUnit.Util.AggregatingTestRunner.Load(TestPackage package)
at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
at NUnit.ConsoleRunner.Runner.Main(String[] args)
2009-11-04 11:47:55,544 [STAR Trunk:WARN] NUnit test output file C:\Program Files\CruiseControl.NET\server\STAR Trunk\Artifacts\nunit-results.xml was not created
2009-11-04 11:47:56,263 [STAR Trunk:DEBUG] Supplied output is not valid xml. Writing as CDATA
2009-11-04 11:47:56,263 [STAR Trunk:DEBUG] Output: ProcessModel: Default DomainUsage: Multiple
Execution Runtime: net-2.0.50727.3603
Unhandled Exception:
System.IO.FileLoadException: Could not load file or assembly 'file:///C:/Program Files/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.DLL' or one of its dependencies. Incorrect function. (Exception from HRESULT: 0x80070001)
File name: 'file:///C:/Program Files/NUnit 2.5.2/bin/net-2.0/lib/nunit.core.DLL'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence)
at System.Activator.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.InternalCreateInstanceFromWithNoSecurity(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.Activator.CreateInstanceFrom(AppDomain domain, String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at NUnit.Core.DomainInitializer.CreateInstance(AppDomain targetDomain)
at NUnit.Util.DomainManager.CreateDomain(TestPackage package)
at NUnit.Util.TestDomain.Load(TestPackage package)
at NUnit.Util.AggregatingTestRunner.Load(TestPackage package)
at NUnit.ConsoleRunner.ConsoleUi.Execute(ConsoleOptions options)
at NUnit.ConsoleRunner.Runner.Main(String[] args)
2009-11-04 11:47:56,263 [STAR Trunk:DEBUG] Exception: System.Xml.XmlException: An error occurred while parsing EntityName. Line 6, position 146.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, Int32 lineNo, Int32 linePos)
at System.Xml.XmlTextReaderImpl.HandleEntityReference(Boolean isInAttributeValue, EntityExpandType expandType, Int32& charRefEndPos)
at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& endPos, Int32& outOrChars)
at System.Xml.XmlTextReaderImpl.ReadValueChunk(Char[] buffer, Int32 index, Int32 count)
at System.Xml.XmlWriter.WriteNode(XmlReader reader, Boolean defattr)
at ThoughtWorks.CruiseControl.Core.Util.XmlFragmentWriter.WriteNode(XmlReader reader, Boolean defattr)
at ThoughtWorks.CruiseControl.Core.Util.XmlFragmentWriter.WriteNode(String xml)
2009-11-04 11:47:56,263 [STAR Trunk:INFO] Integration complete: Failure - 11/4/2009 11:47:55 AM
After mfeingold posted about fusion log below, here's what I got:
*** Assembly Binder Log Entry (11/7/2009 @ 10:26:46 PM) ***
The operation failed.
Bind result: hr = 0x80070001. Incorrect function.
Assembly manager loaded from: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files\NUnit 2.4.6\bin\nunit-console.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = NT AUTHORITY\SYSTEM
LOG: Where-ref bind. Location = C:/Program Files/NUnit 2.4.6/bin/nunit.core.DLL
LOG: Appbase = file:///D:/dev/automatedTrunk/Star/Acuity.UnitTests/bin
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = C:\WINDOWS\TEMP\nunit20\ShadowCopyCache\2272_633932296067629930
LOG: AppName = Tests
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Download of application configuration file was attempted from file:///D:/dev/automatedTrunk/Star/Acuity.UnitTests/bin/Acuity.Diagnostics.dll.config.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
此错误并不一定意味着问题出在 NUnitCore 程序集上。可能无法访问它所需的程序集之一。尝试打开 Fusion 日志 - 运行 fusion 日志查看器。它生成的日志将向您显示有关问题所在的更多详细信息。
要运行融合日志查看器,请从 Visual Studio 打开控制台窗口 ->工具菜单并输入实用程序名称:fuslogvw
This error does not necessarily mean that the problem is with the NUnitCore assembly. It can be that one of the assemblies it needs cannot be accessed. Try turning on Fusion logs - run the fusion log viewer. the logs it will produce will show you more details on whats' wrong.
To run the fusion log viewer open a console window from Visual Studio -> tools menu and type the utility name: fuslogvw
问题:您想通过此配置实现什么目的:
您是否尝试对 nunit.framework.dll 进行单元测试?只是猜测,但这不会导致文件访问问题吗?
无论如何,这会导致更多问题:
nunit.framework.dll
引用指向哪里?尽管这应该是您原来问题的答案,但还是有很多问题。
这是我要尝试的:
nunit.framework.dll
程序集节点C:\Program Files\NUnit 2.5.2\bin\ net-2.0\nunit.framework.dll
Question: What are you trying to achieve with this configuration:
Are you trying to unit test
nunit.framework.dll
? Just guessing, but couldn't this lead to file access problems?Anyway this leads to more questions:
nunit.framework.dll
to be in the compile output folder?nunit.framework.dll
references in your Visual Studio projects point to?So many questions although this is supposed to be an answer to your original question.
This is what I would try:
nunit.framework.dll
assembly node from CCNET configurationC:\Program Files\NUnit 2.5.2\bin\net-2.0\nunit.framework.dll
我从融合日志中看到 NUnit 似乎启用了 ShadowCopy。过去,我在启用此功能时遇到过问题。 CruiseControl 任务似乎不允许关闭此功能,因此您可能必须直接调用命令行工具才能执行此操作。
I see from the fusion logs that NUnit appears to have ShadowCopy enabled. In the past, I've run into issues with this turned on. It doesn't appear that the CruiseControl task allows switching this off so you may have to call the command line tool directly to do this.