MonoGame.Content.Builder.targets error message

Hello all,

I have recently installed Visual Studio 2019 Community and Monogame 3.8 on Windows, following this guide.

Now, I am very new to both C# and Monogame, so I hope you will forgive this question, but: when I create a new game with a Monogame template everything seems to work as intended. Whenever I load an example or tutorial however, VS2019 displays the following message:

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

(Or, in more detail):


C:\Users\info\Downloads\TexturePacker-MonoGame-Demo-master\TexturePacker-MonoGame-Demo-master\TexturePacker-MonoGame-Demo.csproj : error : The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\MonoGame\v3.0\MonoGame.Content.Builder.targets" was not found. Also, tried to find "MonoGame\v3.0\MonoGame.Content.Builder.targets" in the fallback search path(s) for $(MSBuildExtensionsPath) - "C:\Program Files (x86)\MSBuild" . These search paths are defined in "C:\Users\info\AppData\Local\Microsoft\VisualStudio\16.0_bc8db59d\devenv.exe.config". Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths. C:\Users\info\Downloads\TexturePacker-MonoGame-Demo-master\TexturePacker-MonoGame-Demo-master\TexturePacker-MonoGame-Demo.csproj

I think these examples were written for older versions of Monogame? I’ve searched both my PC’s directories and the internet for the file and a solution respectively, but to no avail. Can someone explain what is going on and how I can solve it? Thank you!

I know this is an old issue, but i’m having exactly the same issue when setting up a new computer to work, and I haven’t found any decent explanation, most answers being misleading.

This problem seems to happen when you’re trying to load a project created with an old version of MonoGame, and you install the 3.8 monogame extension for VS2019. The .csproj file tries to find a file in a place is no longer created by the new installers.

You probably have two solutions here:

  1. Install an old version of MonoGame so that it creates the files. The MonoGame dlls will be stale, but you’ll have the build scripts. As you’ll probably be using nuget to keep monogame up to date this doesn’t matter.
    I’ve used this way because I want the project file to work exactly the same in both computers, and I don’t want to mess with 3.8 in the old computer, but if you don’t have this requirement, option 2 will probably be better for you.
    3.7.1 is probably your best option MonoGame 3.7.1

  2. Modify the .csproj file so that instead of pointing to the old targets file, points to the correct place where the new targets file resides (no idea which is it, as I haven’t followed this path). You can even just delete the line (the content builder won’t work but the project will load) and then work from there afterwards.
    The .csproj line is:
    <Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />