jbt*_*ule 150
请参阅danielnixon的回答,了解现在正式执行此操作的方法.
有可能的.
在您自己的单声道计算机上,使用终端,cd进入解决方案目录并运行命令xbuild.这可能会自动工作,也可能不会,因为您在visual studio中使用的功能需要在单声道中进行一些调整.
需要注意的事项:
.csprojLinux具有区分大小写的路径,而Windows不会.export EnableNuGetPackageRestore=true在运行之前要求您xbuild.mozroots --import --sync安装它们.nuget.*而不是NuGet.*.csproj中的引用已经知道存在于各种版本的nuget中..fsproj以通过添加'$(VisualStudioVersion)' == '11.0' Or $(OS) != 'Windows_NT'参见示例来触发非Windows计算机上的VS2012配置.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.使用平台条件(在Mono 3.0.11或更早版本中提到)或升级到3.1.2.<PropertyGroup Condition="$(OS) == 'Windows_NT'"> <TargetFrameworkProfile>Profile46</TargetFrameworkProfile> </PropertyGroup>或Condition="$(OS) != 'Windows_NT'单声道.你的旅费可能会改变.见工作示例..ci/nunit.sh是我自己的用于nunit测试的shell脚本,检查了repo的根目录.所以我可以用nuget安装我想要的nunit-console版本,并配置各种类别的include /排除.你的里程可能会有所不同,但这种技术应该适用于xunit等.或者用xbuild或假冒自己的东西.
#!/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 $?
Run Code Online (Sandbox Code Playgroud)
为了测试最新的单声道,它最容易使用Mac主机(目标是使用language:objective-cMono v3.1.2,后来将Mac上的发行版从DMG更改为PKG,因此安装非常简单.此模板应支持可移植类库,.NET 4.5.1和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
Run Code Online (Sandbox Code Playgroud)
我很容易使用Mac主机为多个版本的Mono设置构建矩阵.见下面的脚本
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
Run Code Online (Sandbox Code Playgroud)
现在你应该好好在你的c#项目中使用travis.
小智 25
这是关键点 - 该项目必须适用于Mono.这主要适用于库式项目(AWS SDK .NET是一个很好的例子),但需要更多的开发工作和纪律.如果您正在为Windows平台开发项目,如WPF应用程序,Azure云服务,Windows Phone/Store应用程序甚至ASP.NET Web API,Linux构建环境将无法运行.
AppVeyor CI是Windows平台的托管持续集成服务,对于开源项目是免费的.这就像Travis CI for Windows!
您可以为VS.NET解决方案,自定义MSBuild项目,PSake或批处理文件的任何PowerShell脚本设置构建过程.此外,AppVeyor还具有内置工件管理和部署框架.
dan*_*xon 16
Travis CI现在支持C#.从该页面大量引用:
概观
C#,F#和Visual Basic项目的设置如下所示:
language: csharp
solution: solution-name.sln
mono:
- latest
- 3.12.0
- 3.10.0
Run Code Online (Sandbox Code Playgroud)
脚本
默认情况下,Travis将运行xbuild solution-name.sln.Xbuild是一个构建工具,旨在成为Microsoft的MSBuild工具的实现.要覆盖它,您可以像这样设置脚本属性:
language: csharp
solution: solution-name.sln
script: ./build.sh
Run Code Online (Sandbox Code Playgroud)
的NuGet
默认情况下,Travis将运行nuget restore solution-name.sln,它将从解决方案文件中恢复所有NuGet包.要覆盖它,您可以像这样设置install属性:
language: csharp
solution: solution-name.sln
install:
- sudo dosomething
- nuget restore solution-name.sln
Run Code Online (Sandbox Code Playgroud)
如前所述,Travis CI 对C#提供测试版支持.我很直接使用.也可以很容易地集成nunit.这是一个运行nunit测试的.travis.yml文件的小例子,如果至少有一个单元测试失败,则将构建标记为失败:
language: csharp
solution: ./src/yoursolution.sln
install:
- sudo apt-get install nunit-console
- nuget restore ./src/yoursolution.sln
script:
- xbuild ./src/yoursolution.sln
- nunit-console ./src/SomeLibrary.Tests/bin/Debug/SomeLibrary.Tests.dll
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13493 次 |
| 最近记录: |