如何使用特拉维斯-CI与C#或F# [英] How do I use Travis-CI with C# or F#

查看:199
本文介绍了如何使用特拉维斯-CI与C#或F#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

特拉维斯CI持续集成服务正式支持多种 的语言,而不是C#或F#。

Travis CI continuous integration service officially supports many languages, but not C# or F#.

我可以用我的.NET项目使用它?

Can I use it with my .net projects?

推荐答案

它是可能的。

在你自己的单声道的机器,使用的终端, CD 到您的解决方案目录运行命令 xbuild 。这可能会自动工作,也可能不会,因为有需要在单声道一些调整,你在Visual Studio中使用的功能。

On your own mono machine, using the terminal, cd into your solution directory and running the command xbuild. This may automatically work, or it may not, as there are features you used in visual studio that need some tweaking in mono.

事情看出来的:


  • 丢失的文件错误,请检查并确保文件名的大小写相匹配你的 .csproj的 Linux具有区分大小写的路径在哪里窗户没有。

  • 的NuGet需要你出口EnableNuGetPackageRestore =运行 xbuild 如果你的项目自动恢复之前真

  • 您的单实例可能没有根SSL证书,使用 mozroots --import --sync 安装它们。

  • 此外,如果你看到丢失的文件错误,的NuGet。* 而不是的NuGet。* 引用在您的.csproj已经知道的NuGet各种版本存在。

  • 有基于空白的.TARGET文件中2.5的NuGet的目标文件中的错误,解决方法这里

  • 对于FSharp 3.0的支持,你需要单3.0.x的或更高版本(并可能需要从源头建立,但默认情况下在Mac OS X安装)

  • 对于从VS2013 FSharp项目中,您可能需要修改 .fsproj 通过增加触发非Windows计算机上配置VS2012 '$(VisualStudioVersion)'== '11 0.0或$(OS)!='Windows_NT看的例如

  • Missing files errors, check to make sure the case of file names matches your .csproj linux has case sensitive paths where windows doesn't.
  • Nuget requires you to export EnableNuGetPackageRestore=true before running xbuild if your project auto restores.
  • Your mono instance may not have root SSL certificates, use mozroots --import --sync to install them.
  • Also if you see missing file errors, nuget.* instead of NuGet.* references in your .csproj have been know to exist in various versions of nuget.
  • There is a bug in 2.5 nuget's target file based on whitespace in the .target file, workaround here
  • For FSharp 3.0 support you need mono 3.0.X or later (and may need to build from source, but installed by default on Mac OS X)
  • For FSharp projects from VS2013, you might need to edit your .fsproj to trigger the VS2012 configuration on non windows machines by adding '$(VisualStudioVersion)' == '11.0' Or $(OS) != 'Windows_NT' see example.

  • 单3.1.2,3.2.4及更高版本PCL支持,但也可以有缺失的PCL错误。查找出在单下面列出的错误3.0.12 因为它仅包括以下框架的引用:


    • V4 2.0,Profile136 的.NET Framework 4,Silverlight的5,的Windows Phone 8,Windows应用商店的应用程序(Windows 8中)

    • V4。 0,Profile14 的.NET Framework 4,Silverlight的5

    • V4.0,Profile147 的.NET Framework 4.0.3,Silverlight的5,的Windows Phone 8,Windows应用商店的应用程序(Windows 8中)

    • V4.0,Profile158 .NET框架4.5,Silverlight的5,的Windows Phone 8,Windows应用商店的应用程序(Windows 8中)

    • V4.0,Profile19 的.NET Framework 4.0.3,Silverlight的5

    • V4.0,Profile24 的.NET Framework 4.5,Silverlight的5
    • V4.0,Profile37 的.NET Framework 4,Silverlight的5,Windows应用商店的应用程序(Windows 8中)

    • V4.0,Profile42 的.NET Framework 4.0.3,Silverlight的5,Windows应用商店的应用程序(Windows 8中)

    • V4.0,Profile47 的.NET Framework 4.5的Silverlight 5,Windows应用商店的应用程序(Windows 8中)

    • V4。 0,Profile5 .NET Framework 4中,Windows应用商店的应用程序(Windows 8中)

    • V4.0,Profile6 的.NET Framework 4.0.3,Windows应用商店的应用程序(Windows 8中)

    • V4.5,Profile49 的.NET Framework 4.5的Windows Phone 8

    • V4.5,Profile7 的.NET Framework 4.5,Windows应用商店的应用程序(Windows 8中)

    • V4.5,Profile78 的.NET Framework 4.5的Windows Phone 8,Windows应用商店的应用程序(Windows 8中)

    • Mono 3.1.2, 3.2.4 and later have pcl support, but can also have the missing PCL errors. Look out for the error listed below under Mono 3.0.12 as it only includes the following framework references:
      • v4.0, Profile136 .NET Framework 4, Silverlight 5, Windows Phone 8, Windows Store apps (Windows 8)
      • v4.0, Profile14 .NET Framework 4, Silverlight 5
      • v4.0, Profile147 .NET Framework 4.0.3, Silverlight 5, Windows Phone 8, Windows Store apps (Windows 8)
      • v4.0, Profile158 .NET Framework 4.5, Silverlight 5, Windows Phone 8, Windows Store apps (Windows 8)
      • v4.0, Profile19 .NET Framework 4.0.3, Silverlight 5
      • v4.0, Profile24 .NET Framework 4.5, Silverlight 5
      • v4.0, Profile37 .NET Framework 4, Silverlight 5, Windows Store apps (Windows 8)
      • v4.0, Profile42 .NET Framework 4.0.3, Silverlight 5, Windows Store apps (Windows 8)
      • v4.0, Profile47 .NET Framework 4.5, Silverlight 5, Windows Store apps (Windows 8)
      • v4.0, Profile5 .NET Framework 4, Windows Store apps (Windows 8)
      • v4.0, Profile6 .NET Framework 4.0.3, Windows Store apps (Windows 8)
      • v4.5, Profile49 .NET Framework 4.5, Windows Phone 8
      • v4.5, Profile7 .NET Framework 4.5, Windows Store apps (Windows 8)
      • v4.5, Profile78 .NET Framework 4.5, Windows Phone 8, Windows Store apps (Windows 8)

      • 单3.0.12有便携式类库的目标,但不是引用程序集。查找无法找到对应的目标框架绰号.NETPortable,版本= V4.0,外形= PROFILEX'的框架。框架集的引用将会从GAC,这可能不是预期的行为得到解决。使用平台的条件(在单3.0.11提及或更早)或升级到3.1。 2。

      • Mono 3.0.12 has the targets for Portable Class Libraries but not the reference assemblies. Look for Unable to find framework corresponding to the target framework moniker '.NETPortable,Version=v4.0,Profile=ProfileX'. Framework assembly references will be resolved from the GAC, which might not be the intended behavior. Use Platform Conditions (mentioned under Mono 3.0.11 or earlier) or upgrade to 3.1.2.

      • 缺少目标的错误,如果它没有的NuGet,这可能是因为你使用的是便携式类库目标或其他目标不存在。如果你的项目可以编译.NET 4.0,你可以修改你的.csproj或.fsproj,所以在.NET上它建立便携式和单声道它建立了.NET 4.0。基本上是由单独的东西放到有条件的属性组<的PropertyGroup条件=$(OS)=='Windows_NT'> < TargetFrameworkProfile> Profile46< / TargetFrameworkProfile> < /的PropertyGroup>!条件=$(OS)=Windows_NT单声道您的里程可能会有所不同,请参见工作<一个HREF =htt​​ps://github.com/ekonbenefits/FSharp.Dynamic/blob/master/FSharp.Dynamic/FSharp.Dynamic.fsproj>例如。

      • Missing Target errors, if it's not nuget, it's probably because you are using a Portable class library target or other target that doesn't exist. If your project can compile for .net 4.0, you can modify your .csproj or .fsproj, so that on .net it builds portable and on mono it builds for .net 4.0. basically by separate things into conditional property groups <PropertyGroup Condition="$(OS) == 'Windows_NT'"> <TargetFrameworkProfile>Profile46</TargetFrameworkProfile> </PropertyGroup> or Condition="$(OS) != 'Windows_NT' for mono. Your mileage may vary. See working example.

      • 此外单声道2.10缺少它的一些Microsoft.Build其中的NuGet需要的类,您可以复制为V3.0.x的dll,这是非常小的,到.nuget目录。(我用它的这里

      • Also Mono v2.10 is missing some of it's Microsoft.Build classes which Nuget needs, you can copy the v3.0.X dll, which is very small, to the .nuget directory. (I used it here)

      .CI / nunit.sh 是NUnit的测试我自己的shell脚本,住进了回购的根源。所以我可以安装NUnit控制台版本,我想的NuGet,并配置各种包括/类别太排除。您的里程可能会有所不同,但这种技术应该的xUnit等工作或做自己的事与xbuild或的

      .ci/nunit.sh is my own shell script for nunit testing, checked into the root of the repo. So I can install the nunit-console version I want with nuget, and configure various include/excludes of categories too. Your mileage may vary, but this technique should work for xunit etc. Or do your own thing with xbuild or fake.

      #!/bin/sh -x
      
      mono --runtime=v4.0 .nuget/NuGet.exe install NUnit.Runners -Version 2.6.1 -o packages
      
      runTest(){
          mono --runtime=v4.0 packages/NUnit.Runners.2.6.1/tools/nunit-console.exe -noxml -nodots -labels -stoponerror $@
         if [ $? -ne 0 ]
         then   
           exit 1
         fi
      }
      
      #This is the call that runs the tests and adds tweakable arguments.
      #In this case I'm excluding tests I categorized for performance.
      runTest $1 -exclude=Performance
      
      exit $?
      



      3。特拉维斯配置为单声道



      单v3.8.0



      有关测试它是最容易使用的Mac主机的最新单(目标使用语言:目标c 单V3.1.2,后来从DMG改变分配在Mac上只是一个PKG所以安装非常简单
      。这个模板应该支持便携式类库,.NET 4.5.1和3.1 FSharp

      3. Configure Travis for mono

      Mono v3.8.0

      For testing the latest mono it's easiest to use Mac hosts (target by using language:objective-c Mono v3.1.2 and later changed distribution on a Mac from a DMG to just a PKG so the install is quite simple. This template should support Portable Class Libraries, .NET 4.5.1, and FSharp 3.1.

      language: objective-c
      
      env:
       global:
        - EnableNuGetPackageRestore=true 
       matrix:
        - MONO_VERSION="3.8.0"
      
      before_install:
       - wget "http://download.mono-project.com/archive/${MONO_VERSION}/macos-10-x86/MonoFramework-MDK-${MONO_VERSION}.macos10.xamarin.x86.pkg"
       - sudo installer -pkg "MonoFramework-MDK-${MONO_VERSION}.macos10.xamarin.x86.pkg" -target /
      
      script:
       - xbuild 
       - .ci/nunit.sh Tests/bin/Debug/Tests.dll
      



      同时针对单V2.10 .X和为V3.0.x



      我的易于使用的Mac主机设置为单声道的多个版本构建矩阵。见下面

      To Target both Mono v2.10.X and v3.0.X

      I's easy to use Mac hosts to setup up for a build matrix for multiple versions of Mono. See script below

      language: objective-c
      
      env:
       global:
        - EnableNuGetPackageRestore=true 
       matrix:
        - MONO_VER="2.10.11"
        - MONO_VER="3.0.12"
      
      before_install:
       - wget "http://download.mono-project.com/archive/${MONO_VER}/macos-10-x86/MonoFramework-MDK-${MONO_VER}.macos10.xamarin.x86.dmg"
       - hdid "MonoFramework-MDK-${MONO_VER}.macos10.xamarin.x86.dmg"
       - sudo installer -pkg "/Volumes/Mono Framework MDK ${MONO_VER}/MonoFramework-MDK-${MONO_VER}.macos10.xamarin.x86.pkg" -target /
      
      script:
       - xbuild 
       - .ci/nunit.sh Tests/bin/Debug/Tests.dll
      



      在Linux




      • 查看回答以下新的测试版的定义。

      • For linux

        • See Answer below for new beta definition.
        • 而现在你应该是好去你的C#项目使用特拉维斯。

          And now you should be good to go to use travis on your c# project.

          这篇关于如何使用特拉维斯-CI与C#或F#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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