我正在配置TeamCity运行一些NUnit测试,TeamCity报告所有测试都通过了,但是它报告构建失败,并显示错误消息“New build status is: NUnit error, {build.status.text}”。
通过查看构建日志,我可以看到无法加载被测程序,以下是报告的错误;
[Step 2/2] 在'C:\ TeamCity \ buildAgent \ work \ f73bb9cce36ccd59 \ ProjectName.Web \ ProjectName.BrowserTests \ obj \ Release \ MyProject.BrowserTests.dll'程序集中运行测试时出现NUnit错误 加载程序集已编译为v4.0.30319、MSIL NUnit运行时是v4.0.30319、x86 System.IO.FileNotFoundException: 找不到文件或程序集'MyProject.Browser,Version=0.24.0.0,Culture=neutral,PublicKeyToken=null'或其中一个依赖项。系统找不到指定的文件。 文件名:'MyProject.Browser,Version=0.24.0.0,Culture=neutral,PublicKeyToken=null'
服务器堆栈跟踪: at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) at System.Reflection.RuntimeAssembly.GetExportedTypes() at NUnit.Core.CoreExtensions.InstallAdhocExtensions(Assembly assembly) at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path) at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites) at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites) at NUnit.Core.TestSuiteBuilder.Build(TestPackage package) at NUnit.Core.SimpleTestRunner.Load(TestPackage package) at NUnit.Core.ProxyTestRunner.Load(TestPackage package) at NUnit.Core.ProxyTestRunner.Load(TestPackage package) at NUnit.Core.RemoteTestRunner.Load(TestPackage package) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
那么,为什么无法加载文件呢?测试都通过了,为什么现在需要加载这个文件?
我已经尝试将NUnit构建步骤中的.NET运行时设置为x86,但无济于事。
环境:Windows 7、VS 2012 Update 2、编译为.NET 4.0、NUnit 2.6.2、TeamCity 7.1。
[Step 2/2] 在'C:\ TeamCity \ buildAgent \ work \ f73bb9cce36ccd59 \ ProjectName.Web \ ProjectName.BrowserTests \ obj \ Release \ MyProject.BrowserTests.dll'程序集中运行测试时出现NUnit错误 加载程序集已编译为v4.0.30319、MSIL NUnit运行时是v4.0.30319、x86 System.IO.FileNotFoundException: 找不到文件或程序集'MyProject.Browser,Version=0.24.0.0,Culture=neutral,PublicKeyToken=null'或其中一个依赖项。系统找不到指定的文件。 文件名:'MyProject.Browser,Version=0.24.0.0,Culture=neutral,PublicKeyToken=null'
服务器堆栈跟踪: at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) at System.Reflection.RuntimeAssembly.GetExportedTypes() at NUnit.Core.CoreExtensions.InstallAdhocExtensions(Assembly assembly) at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path) at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites) at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites) at NUnit.Core.TestSuiteBuilder.Build(TestPackage package) at NUnit.Core.SimpleTestRunner.Load(TestPackage package) at NUnit.Core.ProxyTestRunner.Load(TestPackage package) at NUnit.Core.ProxyTestRunner.Load(TestPackage package) at NUnit.Core.RemoteTestRunner.Load(TestPackage package) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
那么,为什么无法加载文件呢?测试都通过了,为什么现在需要加载这个文件?
我已经尝试将NUnit构建步骤中的.NET运行时设置为x86,但无济于事。
环境:Windows 7、VS 2012 Update 2、编译为.NET 4.0、NUnit 2.6.2、TeamCity 7.1。