2

我正在尝试按照https://developers.google.com/optimization/introduction/installing.html#windows_binary上的说明进行操作,以便可以在 C# 应用程序中使用 or-tools。

我被困在make all台阶上了。我在开发人员命令提示符中,但是这个命令说:

'make' is not recognized as an internal or external command,
operable program or batch file.

我尝试下载 GNU make,但也失败了。make install说“没有目标”,一个光秃秃的make说:

process_begin: CreateProcess(NULL, cl /EHsc /MD /nologo /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -nologo /O2 -DNDEBUG -DUSE_CBC -DUSE_CLP /D__WIN32__ /Iinclude\src\windows /DGFLAGS_DLL_DECL= /DGFLAGS_DLL_DECLARE_FLAG= /DGFLAGS_DLL_DEFINE_FLAG= /Iinclude /Iexamples -DUSE_GLOP -DUSE_BOP -c examples\cpp\costas_array.cc /Foobjs\costas_array.obj, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [objs\\costas_array.obj] Error 2

我还尝试将文件夹中的 DLLbin直接复制到我的项目中。我可以通过这样做来针对它们进行编译,但是当我尝试运行它时出现错误:

System.BadImageFormatException: 'Could not load file or assembly 'Google.OrTools, Version=5.1.6235.37215, Culture=neutral, PublicKeyToken=7a052e3db761d3be' or one of its dependencies. An attempt was made to load a program with an incorrect format.'

我错过了什么?

4

2 回答 2

2

关于 System.BadImageFormatException:

OrTools 二进制格式在 64 位 dll 中提供。

确保您的项目设置为 64 位:

在 Visual Studio 中,您可以通过右键单击项目 --> 属性 --> 构建,平台目标来检查它:这应该设置为 x64。

于 2017-03-26T23:18:24.913 回答
2

如果您对 Web 应用程序有同样的问题,只需使用 IIS Express 启用 64 位Tools -> Options -> Projects and Solutions -> Web Projects -> Use the 64-bit version on IIS Express for web sites and projects 视觉工作室 2019

于 2019-04-08T21:28:40.907 回答