rwgames's picture

Cannot get opentk 1.1 beta 2 to work with opengl4

I get a crash at game.Run() when I'm using the following.

using OpenTK;
using OpenTK.Graphics.OpenGL4;

{"Could not load file or assembly 'OpenTK, Version=, Culture=neutral, PublicKeyToken=bad199fe84eb3df4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"OpenTK, Version=, Culture=neutral, PublicKeyToken=bad199fe84eb3df4"}

I've copied opentk.dll into my project folder from OpenTK/1.1/Release but it's not working.

using OpenTK;
using OpenTK.Graphics.OpenGL;

The above works but I want everything to use the opengl4 specs, am I going about this the wrong way?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
winterhell's picture

"Could not load file or assembly 'OpenTK, Version=" means Visual studio is trying to load version 1.0 whereas you are providing it with 1.1.
Remove OpenTK from the project References in the Solution Explorer window and readd the new version.

rwgames's picture

I've already done that several times as well as just now, the output window after build shows:
Copying file from "... OpenTK\1.1\Binaries\OpenTK\Release\OpenTK.dll" to "bin\Debug\OpenTK.dll" but still get the same error, I can go with the workaround of using 1.0 and OpenTK.Graphics.OpenGL instead of OpenTK.Graphics.OpenGL4 but it would be nice to not have the older commands in the mix;

I see that opentk.dll is version 1.1.1434.30013 but the opentk.xml is version 1.0, maybe that's the problem!!

the Fiddler's picture

That's strange. I routinely use Visual Studio 2010/2012/2013, MonoDevelop 2.8/4.0, Xamarin Studio 4.2 and upgrading OpenTK works across all of those. Which IDE are you using?

If you have multiple projects in your solution, make sure that all of them compile against the *same* version of OpenTK.

If you have ever used NuGet for OpenTK, make sure that the NuGet package is uninstalled - otherwise it will keep overwriting OpenTK.dll.

Conversely, if you are using the .exe installer, try uninstalling OpenTK completely from "Add/Remove Programs". You can then try with the .zip release from here:

rwgames's picture

I'm using Visual Studio 2005 with one project in my solution and am not using NuGet. I also uninstalled OpenTK and used the zip from your link and re-added the reference with no luck, same problem.
I am using Matali Physics and when I disabled all physics code with the #define directive then it works. I tried removing both dll's and adding them in different order but for some reason mataliphysics version 1.8 messes with the new version of OpenTK. For now I'll use older OpenTK until I can figure this out.

the Fiddler's picture

This means that Matali physics is compiled against an older version of OpenTK.dll. Since it's not possible to mix two different versions of a dll in the same process, you will have to use the old version until Matali physics is updated. (It might be worth it to ask them for an updated version.)

rwgames's picture

I contacted Matali Physics and they said they can update once the final version of OpenTK 1.1 is out.
I'm glad to see OpenTK is alive and advancing, keep up the great work and thanks for your help.