google / or-tools

Google's Operations Research tools:
https://developers.google.com/optimization/
Apache License 2.0
11.22k stars 2.13k forks source link

Google.OrTools exception C# .Net Core 2.1 and 3.1 #1989

Closed muisklik closed 4 years ago

muisklik commented 4 years ago

I've downloaded the binary distribution for Windows from https://github.com/google/or-tools/releases/download/v7.6/or-tools_VisualStudio2019-64bit_v7.6.7691.zip and ran the command tools\make test_dotnet. It fails with the error Unhandled exception. System.BadImageFormatException: Could not load file or assembly 'Google.OrTools, Version=7.6.7691.0, Culture=neutral, PublicKeyToken=53dbb1ea090cbef7'. An attempt was made to load a program with an incorrect format. File name: 'Google.OrTools, Version=7.6.7691.0, Culture=neutral, PublicKeyToken=53dbb1ea090cbef7' at SimpleLpProgram.Main()

The command dotnet --list-sdks shows: 2.1.805 [C:\Program Files (x86)\dotnet\sdk] 3.1.201 [C:\Program Files (x86)\dotnet\sdk]

Last week I was working on a project using Google OR-Tools without any issue using .Net Core 2.1 and this week it won't work. No updates have been done in the meantime AFAIK.

The Microsoft Visual C++ Redistributable for Visual Studio 2019 has been installed after this error message is popping up. PC is restarted after installation with no success.

PC is using Windows 10 Pro 64 bit Version 1909.

ptr1120 commented 4 years ago

Please ensure that your runtime project uses x64 as Platform configuration.

muisklik commented 4 years ago

The solution for me was returning to an automatic system restore points made in the time span between working and not working.