Cannot build MonoGame.Framework.Windows

I get the following errors:

I’ve tried building in both Visual Studio 2010 and Visual Studio 2012. Our other dev gets the same errors on his computer.

I think my other problem here is related: Unresolved Assembly Woes

These same errors occur for all the projects in the solution. I’m stumped.

2>------ Build started: Project: 2MGFX.Windows, Configuration: Debug Any CPU ------
2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference “SharpDX” 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 “SharpDX” or retarget your application to a framework version which contains “System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.
2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference “SharpDX” 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 “SharpDX” or retarget your application to a framework version which contains “System.Runtime.InteropServices.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.
2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference “SharpDX” 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 “SharpDX” or retarget your application to a framework version which contains “System.ObjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.
2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3268: The primary reference “SharpDX” 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 “SharpDX” or retarget your application to a framework version which contains “System.Numerics.Vectors, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”.
2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly “SharpDX.D3DCompiler”. Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly “CppNet”. Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

Without access to the solution and projects, it still looks like there is something crossed over between projects where a configuration contains one or more of projects use .NET 4.0 and one or more other projects use .NET 4.0 Client.

But in this case I’m just trying to build the mono game framework, a fresh download, no changes at all. All the projects are .NET 4.0, there are no Client Profile targets. I even tried .NET 4.5, same result. I’m baffled. The VS object browser can browse the referenced assemblies, so the references are valid, just the build fails.

I had this same error and eventually stumbled across this: Cannot compile Monogame 3.2 with VisualStudio or Xamarian Studio

Checking out the project with the git “Recurse” option (or using Submodule > Update) fixed this error for me.

Hi

I got all the code using the Git Desktop. Develop branch 19th August.

Win 10, VS2015 Enterprise, clean code, used Protobuild, and gained the sln files.
Opened up, on build, it gets the nuget dependencies etc.
Up to here, all looking good. But on build I get 1 error per project of the following format:

Severity Code Description Project File Line
Error Couldn’t find the required information in the lock file. Make sure you have .NETFramework,Version=v4.0 mentioned in your targets. MonoGame.Framework.Windows

MS won’t let me install .net 4.0, as I have 4.6 installed. Am I missing an SDK or something?

I’m trying to build, as I wish to hunt a memory leak, which I’m pretty sure is low down. I will post on that separately.

Many thanks for any help / pointers.

Graham

Had a similar problem here Monogame nuget 3.2 package built using .NET 4.5?

You select the Target .NET Framework Version in the Project Properties. This can be changed in the MonoGame projects to match that of your game project, or you could set your game project’s target framework version to match the MonoGame target version.

Thanks chaps,

Its actually all building fine in Xamarin Studio on the PC, so I’ve gone that way for the moment.
I tried moving the Framework setting in Project Properties before my initial post, but I just got an even longer set of errors.

I’m seeing these errors now too.

Ok, I agree that getting MonoGame.Framework.Windows.sln to build in VS2015 is ridiculous.

I’m installing VS2013 Community again now so I can get some productive work done, but we have to get this situation sorted out soon.

Can you confirm that its working all ok in VS2013? If so, that’s certainly an option for me to simply install that.

Any update on this? I’m getting the same issue as GrahamEHughes. I don’t really want to go back to 2013.

For me I couldn’t build in VS 2013.

VS 2015 - I added SharpDX, commented out a few bits of code that wouldn’t compile, but aren’t in code we are using, and then fell at the final hurdle with another issue surround a ‘lock’ file, which I couldn’t get past. So I got it down to 1 error!

I then fired up Xamarin Studio on my PC, loaded the same sln, and it compiles fine. So I’m currently using XS for my Monogame fixes.

Graham

It is a known issue with Nuget in VS2015 because of the project.json file. If you’re not doing UWP development, you can delete the project.json file and it should work.

Many thanks.

I just found out, that having opened it in XS, VS is now also reading it…

We should remove the project.json file from the repository. It is not compatible with cross-platform projects, and causes issues for Visual Studio 2015.

It should be possible to build for Windows Universal without requiring project.json; it is simply an alternative MSBuild format that Visual Studio will pick if it’s there.

That was fixed two months ago. Along with an update to Nuget for VS2015, it was renamed to have the project name as well. It no longer affects other platforms.

as far as i can see, Visual Studio 2015(and possibly the other ones) will throw the error with the .net version when referencing the assemblies directly from Reference manager, where you select it and it even tells the correct destination from the list of assemblies in your projects reference drop down, but checking the reference manager again you will notice that Visual Studio keeps trying to select a different version of it that it is supposed to.

I got rid of my problem simply moving a copy of the assemblies directly to my project folder and targetting it via browse.

Hopefully this can help you guys!