I have installed the package Google.OrTools via NuGet but running the test program Visual Studio see this exception:
System.BadImageFormatException: 'Could not load file or assembly 'Google.OrTools, Version=7.0.6546.0, Culture=neutral, PublicKeyToken=53dbb1ea090cbef7' or one of its dependencies. An attempt was made to load a program with an incorrect format.'
Which test program ? Are you using a Windows 64bits (i.e. what is your runtime platform) ?
I tried to run ShiftScheduling.cs
Yes it is 64 bit
note on windows Google.OrTools depends on Google.OrTools.runtime.win-x64
does it works if using the dotnet cli directly ?
note: on my way to test too
I tried many times. But each time I see this exception:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Google.OrTools, Version=7.0.6546.0, Culture=neutral, PublicKeyToken=53dbb1ea090cbef7' or one of its dependencies. The system cannot find the file specified.
Can you check that visual studio c++ redistributables are installed.
Maybe they are not if you just install the C# layer.
Laurent Perron | Operations Research | [email protected] | (33) 1 42 68 53
00
Le jeu. 11 avr. 2019 à 18:14, Alvin notifications@github.com a écrit :
I tried many times. But each time I see this exception:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file
or assembly 'Google.OrTools, Version=7.0.6546.0, Culture=neutral,
PublicKeyToken=53dbb1ea090cbef7' or one of its dependencies. The system
cannot find the file specified.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/google/or-tools/issues/1185#issuecomment-482398246,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AKj17Z0Gch65AoE95VqhJDWhLMyURUbKks5vf93ugaJpZM4cpLQQ
.
Visual Studio C++ redistributables 2017 (x64) are installed.
Create a pet project to "consume" Google.OrTools nuget package
This use the Appveyor VS 2017 worker image
src: https://github.com/Mizux/or-tools-demo
log: https://ci.appveyor.com/project/Mizux/or-tools-demo
The problem solved at last through migration to a new project on .Net Framework 4.7.2 and installing the latest version of google or-tools and running x64. Thanks @lperron @lperron
The problem solved at last through migration to a new project on .Net Framework 4.7.2 and installing the latest version of google or-tools and running x64. Thanks @lperron @lperron
i have the VS 2019 with .Net Framework 4.7.2 but i am having the same issue i don't know how to resolve it.
Have you tried to remove Prefer 32 Bit in Project Properties / Build / Platform Target?
@zohaibdhukka Maybe you are referencing an assembly (Google.OrTools.dll) that was signed with no key or a different one. If you open the .csproj file with a text editor you should find the reference to the or-tools. Try to remove PublicKeyToken from this reference and see if that works. That option is used to guarantee that you're loading the assembly against which you built the application. Otherwise check the assembly that is in the bin folder and which is tried to be loaded. Is it the same? In general, this should not be an or-tools specific problem.
Have you tried to remove Prefer 32 Bit in Project Properties / Build / Platform Target?
@Eudaemonic This worked for me, thanks legend
Most helpful comment
Have you tried to remove Prefer 32 Bit in Project Properties / Build / Platform Target?