Unresolved Assembly Woes

PC Windows 7

I have a weird problem. I’m in the process of porting my XNA game to MonoGame. It’s called Total Miner: Forge. It’s a big game, probably the biggest game on the Xbox Live Indie Games channel in terms of code base size and content.

For the visual studio projects, I’ve followed the same pattern as the Xbox pattern, that is one visual studio solution for everything, it contains all the assemblies for both the PC and Xbox platforms. Each assembly has a PC project and an Xbox Copy of ‘’ project which can be automatically generated by XNA Game Studio.

So to keep that pattern I’ve added a 3rd project for each assembly called Mono-Win Copy of ‘’, and these projects reference the MonoGame dll’s.

The solution builds and the game runs (or hobbles at the moment), but if I build and run again, I get the errors listed at the bottom of this message, and then the compiler just craps out with a thousand errors not being able to find any types from referenced assemblies. The work around is to clean the solution, close/reopen visual studio, and rebuild/run. But there is a huge amount of content/assets, and it takes around 3-4 minutes to build. Having to do this everytime I run the game (even if I don’t make any changes) is incredibly tedious, and unworkable.

The Target Framework for my MonoGame projects are set to use .Net Framework 4.
The Target Frameworks for the XNA PC and Xbox projects are .Net Framework 4 Client Profile.

I’m not rebuilding the MonoGame source, I’m just using the binaries.
These errors now occur for all three platform projects for each assembly, not just the MonoGame project.
If I remove the MonoGame projects from the solution, everything works properly again.

Here are the errors.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference “D:\Documents\Craig XNA\bin\x86\Debug\xxx.dll” could not be resolved because it has an indirect dependency on the framework assembly “System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” which could not be resolved in the currently targeted framework. “.NETFramework,Version=v4.0”. To resolve this problem, either remove the reference “D:\Documents\Craig XNA\bin\x86\Debug\xxx.dll” or retarget your application to a framework version which contains “System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference “D:\Documents\Craig XNA\bin\x86\Debug\xxx.dll” could not be resolved because it has an indirect dependency on the framework assembly “System.Runtime.InteropServices.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” which could not be resolved in the currently targeted framework. “.NETFramework,Version=v4.0”. To resolve this problem, either remove the reference “D:\Documents\Craig XNA\bin\x86\Debug\xxx.dll” or retarget your application to a framework version which contains “System.Runtime.InteropServices.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference “D:\Documents\Craig XNA\bin\x86\Debug\xxx.dll” could not be resolved because it has an indirect dependency on the framework assembly “System.ObjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” which could not be resolved in the currently targeted framework. “.NETFramework,Version=v4.0”. To resolve this problem, either remove the reference “D:\Documents\Craig XNA\bin\x86\Debug\xxx.dll” or retarget your application to a framework version which contains “System.ObjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference “D:\Documents\Craig XNA\bin\x86\Debug\xxx.dll” could not be resolved because it has an indirect dependency on the framework assembly “System.Numerics.Vectors, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” which could not be resolved in the currently targeted framework. “.NETFramework,Version=v4.0”. To resolve this problem, either remove the reference “D:\Documents\Craig XNA\bin\x86\Debug\xxx.dll” or retarget your application to a framework version which contains “System.Numerics.Vectors, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.

Are all projects building to the same output directory? I would suggest setting the MonoGame-targeted project to build to a separate output directory, similar to how PC and Xbox build to separate output directories.

Yes the MonoGame projects build to their separate output directories. This also allows me to retain the same assembly/dll names across all platforms.

D:\Documents\Craig XNA\bin\x86\Debug is the output directory of the MonoGame projects?

No. Those errors are for the regular XNA PC projects. I get the same errors for all three platforms. XNA PC, XBOX and MonoGame Windows. The same errors occur on the other projects with their corresponding output directories. It’s odd. If I remove the MonoWin projects, the solution builds fine for the XNA PC and XBOX projects (as it did before I started the port to MonoGame). But if I add the MonoGame projects back in, all three projects get these errors, even though the only thing they have in common is the source files themselves. In terms of the projects, and referenced assemblies, they’re all separate.