Correcting Libraries To Build on Monogame 3.5

Hi Folks,

During some upgrade activity this evening I ran into a simple build problem with some libraries I build from source.

First - make sure you are targeting .NET 4.5.

Second, update any folder references from WindowsGL assemblies to DesktopGL. The platform was consolidated.

IE, Look in your project file (.csproj) for:

<Reference Include="MonoGame.Framework">
    <HintPath>$(MSBuildExtensionsPath)\..\MonoGame\v3.0\Assemblies\WindowsGL\MonoGame.Framework.dll</HintPath>
</Reference>

Alter to be:

<Reference Include="MonoGame.Framework">    
    <HintPath>$(MSBuildExtensionsPath)\..\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll</HintPath>
</Reference>

Hope this helps.

Further to this. If you want to support building on Mac/Linux you will need to do the following in your .csproj

  1. At the top of your .csproj Immediate after the <Project element add

<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props')" />

This will import the new .props file which defines the $(MonoGameInstallDirectory) msbuild property.

  1. If you have declarations for <MonoGameInstallDirectory> in your csproj remove them.
  2. Change your HintPath values from

$(MSBuildExtensionsPath)\..\MonoGame\v3.0\Assemblies\<platform>\MonoGame.Framework.dll

to

$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\<platform>\MonoGame.Framework.dll

  1. Make sure your import the content builder targets at the bottom of the project (just above the final

<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />