Running Gurobi in Visual Studio 2010

761 views
Skip to first unread message

Kanuri Vamsi Krishna

unread,
Jun 25, 2013, 7:20:54 PM6/25/13
to gur...@googlegroups.com
Hi,

I installed Gurobi and added the Gurobi55.Net.dll reference to my C# project in Visual Studio 2010. The programs builds just fine but in run time, it throws the following exception:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

Source Error:

Line 40:                 // Model
Line 41:                 
Line 42:                 GRBEnv env = new GRBEnv();
Line 43:                 GRBModel model = new GRBModel(env);
Line 44:                 model.Set(GRB.StringAttr.ModelName, "diet");

I tried changing the platform in Visual Studio to x86 but in vain. Is anyone aware of this problem and a way to solve this? Please let me know. Thanks!

Vamsi

Ed Rothberg

unread,
Jun 26, 2013, 10:18:57 AM6/26/13
to gur...@googlegroups.com

That is indeed a 32/64-bit issue.  Here's an article about setting the Platform Target...


I doubt that x86 is what you need.  .NET will default to 64-bit on a 64-bit machine.

Ed



Kanuri Vamsi Krishna

unread,
Jun 26, 2013, 1:05:52 PM6/26/13
to gur...@googlegroups.com
Thanks for your reply. But the problem isn't getting fixed even when I change the Platform Target to x86.

Another point to note is that when I was loading the DLL into my project, I navigated to the bin/64bit folder in Gurobi folder. There are no 32 bit DLLs available. Do you think this is something that has to do with the version of Gurobi? I am using the latest 5.0 version.


Vamsi

Xiaoqiu QIU

unread,
Mar 12, 2014, 10:48:27 AM3/12/14
to gur...@googlegroups.com
Hi Vamsi,

I had the same issue. I downloaded the Gurobi 5.6.2 (the currently latest) in 32-bit, installed it, and then set my reference path and the Gurobi56.Net DLL link to the 32-bit version, and it works just like the sample code.

I hope this helps.

Jim
Reply all
Reply to author
Forward
0 new messages