Run unit test for "OR-Tools" and "System.BadImageFormatException"

504 views
Skip to first unread message

Avishay Far

unread,
Nov 27, 2014, 8:41:57 AM11/27/14
to or-tools...@googlegroups.com

Hi 

I have implemented my LP modeling with the "OR-Tools" using the LinearSolver.
and it works fine..  however when i try test my module with MSFT unit tests (Microsoft.VisualStudio.TestTools.UnitTesting)
i get the error "System.BadImageFormatException: Could not load file or assembly 'Google.OrToo'" 
do you have any idea?  i need run tests and i can't...
[this error also when i  change the "Platfrom target" to X86 or X64.
i get this error when i run it via the visual stdio or via the resharper]

thanks for your help

Avishay Far

unread,
Dec 1, 2014, 7:09:47 AM12/1/14
to or-tools...@googlegroups.com
with the 32bit dll this exception disappear however we need the 64bit dll... 

Laurent Perron

unread,
Dec 1, 2014, 7:38:01 AM12/1/14
to or-tools...@googlegroups.com
Which one did you build/download, or add as assembly to the project?

There seems to be a mistmatch here.

Thanks

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Avishay Far

unread,
Dec 1, 2014, 9:37:49 AM12/1/14
to or-tools...@googlegroups.com
or-tools.VisualStudio2012-64b
And
or-tools.VisualStudio2012-32b

the first (64b) cause to the "Bad Image" exception.

thanks  a lot 

Michael Powell

unread,
Feb 26, 2016, 8:11:24 PM2/26/16
to or-tools-discuss


On Monday, December 1, 2014 at 9:37:49 AM UTC-5, Avishay Far wrote:
or-tools.VisualStudio2012-64b
And
or-tools.VisualStudio2012-32b

the first (64b) cause to the "Bad Image" exception.

Ditto BagImageFormatException.

Both should be possible to include in the NuGet package AFAIK. 

Rob

unread,
Feb 27, 2016, 7:41:24 AM2/27/16
to or-tools-discuss
Have you enabled the x64 support on unit tests in visual studio? 
Under Test -> Test Settings -> "Default Processor Architecture" -> x64. By default it is x86. Sometimes you also have to restart visual studio in order for the change to take effect.

Michael Powell

unread,
Feb 27, 2016, 12:09:35 PM2/27/16
to or-tools...@googlegroups.com
On Sat, Feb 27, 2016 at 7:41 AM, Rob <robert.be...@gmail.com> wrote:
> Have you enabled the x64 support on unit tests in visual studio?
> Under Test -> Test Settings -> "Default Processor Architecture" -> x64. By
> default it is x86. Sometimes you also have to restart visual studio in order
> for the change to take effect.
>
> https://msdn.microsoft.com/en-us/library/ee782531.aspx

I had a similar issue myself. First with the test setting; indeed was
x86 and not x64, in my case.

Then with running an ASP.NET MVC application hosting Google.OrTools;
still would like an Any CPU target, or even potentially a DNX Core,
but this will work for the time being.

Drop this in a .REG file and run it. That allows debugging against IIS
Express 64-bit.

<reg>
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\WebProjects]
"Use64BitIISExpress"=dword:00000001
</reg>

> On Thursday, November 27, 2014 at 3:41:57 PM UTC+2, Avishay Far wrote:
>>
>>
>> Hi
>>
>> I have implemented my LP modeling with the "OR-Tools" using the
>> LinearSolver.
>> and it works fine.. however when i try test my module with MSFT unit
>> tests (Microsoft.VisualStudio.TestTools.UnitTesting)
>> i get the error "System.BadImageFormatException: Could not load file or
>> assembly 'Google.OrToo'"
>> do you have any idea? i need run tests and i can't...
>> [this error also when i change the "Platfrom target" to X86 or X64.
>> i get this error when i run it via the visual stdio or via the resharper]
>>
>> thanks for your help
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "or-tools-discuss" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/or-tools-discuss/VT_sD_TeVXM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
Reply all
Reply to author
Forward
0 new messages