如何在travis-ci上构建Monogame c#项目

时间:2016-05-05 10:30:32

标签: c# travis-ci monogame

travis-ci构建说

.. could not import "$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets"

将此文件移动到我的项目并在我的.csproj文件中编辑它的路径后,它表示无法找到mgcb.exe

travis-ci中的文件在哪里或如何添加文件。

1 个答案:

答案 0 :(得分:1)

所以我们需要安装monogame sdk

注意:由于this

,它必须是版本= <3.4

我们需要编辑或.travis.yml并安装monogame并执行MGCB.exe

language: csharp
solution: Project.sln
before_install:
  - wget http://www.monogame.net/releases/v3.4/MonoGame.Linux.zip
  - unzip MonoGame.Linux.zip
  - find * -type f -exec chmod 777 {} \; # lazy just make all executable
install:
  - sudo apt-get install -qq monodevelop libopenal-dev referenceassemblies-pcl ttf-mscorefonts-installer gtk-sharp2; # install needed packages for the monogame sdk
  - sudo ./generate.sh && yes Y|sudo ./monogame-linux.run; # install monogame sdk
script:
  - (cd Project/Content && mono /opt/monogame-pipeline/MGCB.exe /rebuild /@:"Content.mgcb" /outputDir:"../bin/Release/Content") 

我还使用an older version of the .targets file并在

之前添加
<MonoGameContentBuilderExe Condition="'$(MonoGameContentBuilderExe)' == ''">$(MSBuildExtensionsPath)\MonoGame\v3.0\Tools\MGCB.exe</MonoGameContentBuilderExe>

这个:

<MonoGameContentBuilderExe Condition=" '$(OS)' != 'Windows_NT' And Exists ('/opt/monogame-pipeline/MGCB.exe') ">/opt/monogame-pipeline/MGCB.exe</MonoGameContentBuilderExe>

对我来说xbuild没有自动构建这个,所以我手动完成了。