jmattheis
jmattheis

Reputation: 11135

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

The travis-ci build says

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

after moving this file to my project and editit the path from it in my .csproj file it says that the mgcb.exe cannot be found.

Where is the file in travis-ci or how can I add the file.

Upvotes: 0

Views: 495

Answers (1)

jmattheis
jmattheis

Reputation: 11135

So we need to install the monogame sdk

Note: It need to be a version =<3.4 because of this

We need to edit or .travis.yml and install monogame and execute the 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") 

Also I used an older version of the .targets file and added before

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

this:

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

For me xbuild doesn't automatically build this so I did it manually.

Upvotes: 1

Related Questions