I made a MonoGame project and exported it as a Visual Studio template file.
When I create a new project from that template inside Visual Studio default project folder (in my case, *C:\Users\Ronen\Documents\Visual Studio 2015\Projects*), everything works fine and it builds and compile out of the box.
However, if I try to use the template outside the default Visual Studio folder, for example here: C:\Users\Ronen\Documents\test, I'm getting the following build errors:
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4106,5): error MSB3030: Could not copy the file "C:\Users\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\x86\SDL2.dll" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4106,5): error MSB3030: Could not copy the file "C:\Users\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\x64\SDL2.dll" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4106,5): error MSB3030: Could not copy the file "C:\Users\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\x86\soft_oal.dll" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4106,5): error MSB3030: Could not copy the file "C:\Users\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\x64\soft_oal.dll" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4106,5): error MSB3030: Could not copy the file "C:\Users\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\x86\libSDL2-2.0.so.0" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4106,5): error MSB3030: Could not copy the file "C:\Users\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\x64\libSDL2-2.0.so.0" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4106,5): error MSB3030: Could not copy the file "C:\Users\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\x86\libopenal.so.1" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4106,5): error MSB3030: Could not copy the file "C:\Users\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\x64\libopenal.so.1" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4106,5): error MSB3030: Could not copy the file "C:\Users\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\libSDL2-2.0.0.dylib" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4106,5): error MSB3030: Could not copy the file "C:\Users\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\libopenal.1.dylib" because it was not found.
1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4106,5): error MSB3030: Could not copy the file "C:\Users\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll.config" because it was not found.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
As you can see, MonoGame searches for its assemblies in the wrong place!
I'm pretty sure I don't have Users/Program Files (x86) on my computer.... (note the "C:\Users\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\x86\SDL2.dll" part). Whats even stranger, is that if I put in different folders I get different random paths. For example if I put in c:/projects/something/ I get paths like C:\Users\Ronen\AppData\Program Files (x86)...
I think it has something to do with this variable $(MonoGameInstallDirectory) which Visual Studio use to copy MonoGame files. For some reason it gets terribly broken when using templates.. Probably it uses some relative path somewhere, which explains why it works when I put my project in Visual Studio's default projects dir.
I could fix it manually for every project I create from the template, but I want to release the template itself for other people so I need to fix that in the template level.
Any ideas how to solve this problem? And should I report it to MonoGame team or am I just doing something wrong here?
I searched for "MonoGameInstallDirectory" definition anywhere inside the template zip but couldn't find where its defined.
Thanks!
Edit:
BTW this is super easy to reproduce (visual studio 2015):
- Create new MG cross desktop project.
- Export as template.
- Use template to create a project anywhere but the default Visual Studio projects dir.