Problems with travis for C#

依然范特西╮ 提交于 2019-12-08 02:49:44

问题


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

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 

but failed.. 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.


回答1:


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

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

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.

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.



来源:https://stackoverflow.com/questions/27423489/problems-with-travis-for-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!