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

How to build a Monogame c# project on travis-ci

travis-ci 构建说

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

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

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

所以我们需要安装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 不会自动构建它,所以我手动构建了它。