Building on visual studio online

I have been using Visual studio online to host the repo for my game project, and I recently noticed that the monogame components wouldn’t build. I get the following error;

error MSB4226: The imported project “C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\MonoGame\v3.0\MonoGame.Content.Builder.targets” was not found

I have searched around to no avail but I am still clinging to hope that it is possible. Has anyone gotten this working with the hosted build agent in Visual Studio Online?

Just in case anyone needs an answer to this, I was able to get this to work by including the entire MonoGame directory from C:\Program Files (x86)\MSBuild into a project to hold dependencies, then update the below line in your game project to point to this new project location;
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />

If you have any custom content loaders you’ll need to set those up too in the .mgcb file.

For anyone looking at this who controls the nuget packages, it would be nice to have these files included in a nuget package or something to avoid these kinds of gymnastics.


This is kind of old, but I just want to say this saved me a ton of time, thank you!