[Solved] The Windows8 assembly is loaded instead of WindowsDX

Hi,

I’ve updated my project to MonoGame 3.5. It’s a Win32 project. When I compile it, I’ve an error because the project has loaded the Windows8 assembly instead of Windows (aka Windows DX).

This is a screenshot of my project

You can take a look at my project here

This is the Windows target that is selected, not Windows8.

The workaround for now is to rename Windows to Windows8 in my monogame setup in Programs Files, but it’s not a good solution. I’ve this issue on two PC, so I suspect that it’s my project files which are bad.

Thanks for your help!

Not being able to find anything else wrong, this might be something. It looks like your csproj might be a Windows8 class library project. Looking at the ProductVersion node at the top of the csproj file, it reads 8.0.30703, which is the same as the ProductVersion in MonoGame’s Windows8 csproj. Our Windows csproj has a ProductVersion of 10.0.0, and a regular Windows class library I created earlier today has no ProductVersion node at all.

Also, you appear to be missing the import of the MonoGame.Common.props file at the top. Replace the import of Microsoft.Common.Props with

<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props')" />

This will setup the MonoGameInstallDirectory property that is used in the HintPath of the MonoGame reference.

Thanks it works ! I replaced the import by the one you given

So the hint path failed due to the property having no value, so it appeared to find the first assembly with a matching name? Strange. Glad the problem is fixed.