travis for C#的问题 [英] Problems with travis for C#

查看:97
本文介绍了travis for C#的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Travis CI 现在支持C#(处于测试版中). 在尝试了8种不同的方法之后,我找不到解决问题的方法.

Travis CI now supports C# (in beta). After try 8 different methods, I can't find a solution to my problem.

我有一个ASP MVC项目,travis使用mono,我知道我无法在travis中构建此类项目

I have an ASP MVC project, travis use mono and I know that I can't build in travis this kind of project

script:
    - xbuild project.sln

好的,没问题,但是我想通过测试,发现的最佳解决方案是:

Ok no problem with this but I want to pass my tests, the best solution that I find is:

language: csharp
solution: OptionType.sln
install:
  - sudo apt-get install mono-devel mono-gmcs nunit-console
script:
  - nunit-console MSPSpain.Tests/bin/Debug/MSPSpain.Tests.dll 

但是失败了.. https://travis-ci.org/MSPSpain/Website/builds/43711017

936ProcessModel: Default    DomainUsage: Single

937Execution Runtime: mono-4.0

938Missing method .ctor in     assembly /home/travis/build/MSPSpain/Website/MSPSpain.Tests/bin/Debug/MSPSpain.Tests.dll, type     Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute

939Can't find custom attr constructor     image: /home/travis/build/MSPSpain/Website/MSPSpain.Tests/bin/Debug/MSPSpain.Tests.dll mtoken:     0x0a000011

940Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.UnitTestFramework,     Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

941

942The command "nunit-console MSPSpain.Tests/bin/Debug/MSPSpain.Tests.dll" exited with 254.

我对此进行了很多搜索,但找不到最佳解决方案.

I searched a lot about this and I can't find the best solution to my problem.

推荐答案

您的测试正在使用MSTest并引用通常由Visual Studio安装的Microsoft.VisualStudio.QualityTools.UnitTestFramework程序集.

Your tests are using MSTest and referencing the Microsoft.VisualStudio.QualityTools.UnitTestFramework assembly which is typically installed by Visual Studio.

Microsoft.VisualStudio.QualityTools.UnitTestFramework将不包含在Mono中.

The Microsoft.VisualStudio.QualityTools.UnitTestFramework will not be included with Mono.

可能最简单的解决方案是切换为使用NUnit如果要在Windows和Mono上运行测试,请使用MSTest .

Probably the simplest solution is to switch to using NUnit instead of MSTest if you want to run the tests on both Windows and Mono.

虽然可以在没有Visual Studio的情况下安装 MSTest 在Windows上,我怀疑这在非Windows操作系统上是不可能的.

Whilst it is possible to get MSTest installed without Visual Studio on Windows I suspect this will not be possible on a non-Windows operating system.

这篇关于travis for C#的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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