Build error after Monogame 3.7 and last VS 2017 update

Hi !

I just updated VS 2017 to 15.9.13 (installed with .NET Desktop) and Monogame to 3.7.1. Everything built fine before these updates, and now getting the following build error :

No way to resolve conflict between “System.Runtime.WindowsRuntime, Version=4.0.11.0, Culture=neutral, PublicKeyToken=b77a5c561934e089” and “System.Runtime.WindowsRuntime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”. Choosing “System.Runtime.WindowsRuntime, Version=4.0.11.0, Culture=neutral, PublicKeyToken=b77a5c561934e089” arbitrarily.
3> Consider app.config remapping of assembly “System.Runtime.WindowsRuntime, Culture=neutral, PublicKeyToken=b77a5c561934e089” from Version “4.0.10.0” [] to Version “4.0.11.0” [] to solve conflict and get rid of warning.
3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the “AutoGenerateBindingRedirects” property to true in the project file.

When I use “Auto-generate bindings redirects”, no more build error, but when I run the program, I get the following exception :

Could not load file or assembly ‘System.Runtime.WindowsRuntime, Version=4.0.11.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ or one of its dependencies. The system cannot find the file specified.

It occurs when this code is executed :

graphics = new GraphicsDeviceManager(this);

Any idea how to solve this problem ?

Thank you very much in advance !

System.Runtime.WindowsRuntime sounds like UWP. Is this a UWP project?

If not, maybe the monogame DLL has “changed” to UWP (it happens to me sometimes when updating or restoring backups). Check that your MonoGame.Framework DLL in the References section points to the platform you’re targetting.

If it’s UWP, then no idea.

That was exactly the problem @KakCAT , thanks a lot !

For whatever reason (due to Monogame 3.7.1 or VS 2017 15.9.13 update ?), all my previous references to “Monogame.Framework for all OpenGL Desktop Platforms” were replaced by “Monogame.Framework for Universal Windows Platform”.

So, I tried to replace it using VS Reference manager… For whatever reason (again!), when I selected the reference to “Monogame.Framework for all OpenGL Desktop Platforms”, it actually added a reference to “Monogame.Framework for Universal Windows Platform”… But I realized it only after checking the path of the reference (“Monogame_Folder/[…]/WindowsUniversal/” and not “Monogame_Folder/[…]/DesktopGL/” as I chose !).

Finally, I added the “.dll” manually and everything went fine… -_-’

(I also noticed that the reference to the Lidgren dll I used, installed with NuGet, was replaced by a Lidgren dll found in “Monogame_Folder/[…]/Windows”; but it doesn’t seem to impact the project… By security I manually replaced it by the original one).

TL;DR : References messed up after VS or Monogame update + Wrong paths in Reference manager -_-'