在c#中使用Microsoft Solver Foundation



我试图在VS2010 Ultimate的c#应用程序中使用Microsoft Solver Foundation。我已经安装了MSF(64位版本),据我所知,我应该能够在声明后使用这些服务:

using Microsoft.SolverFoundation;

然而,我得到错误"类型或命名空间名称'SolverFoundation'在命名空间'Microsoft'中不存在"。

我看到有一个Microsoft. solver . foundation .dll位于C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.0

最初我认为64位版本可能是问题,所以我卸载并切换到32位版本。但也没有成功。

如何将MSF集成到我的c#应用程序中?

我试图在VS2010 Ultimate的c#应用程序中使用Microsoft Solver Foundation。我已经安装了MSF(64位版本),据我所知,我应该能够在声明后使用这些服务:

using Microsoft.SolverFoundation;

如何将MSF集成到我的c#应用程序中?

你没有提到你在项目中添加了对这个库的引用,你所描述的行为与没有添加引用是一致的。因此,您还需要在项目中添加对该库的引用。

我已经尝试添加引用之前,但它不会工作。现在我注意到警告中的一些东西(我以前可能没有看到):

"The referenced assembly "Microsoft.Solver.Foundation, Version=3.0.1.10599, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project."

我通过设置应用程序属性->应用程序->目标框架来解决这个问题。. Net Framework 4客户端配置文件" to "。. Net Framework 4".

当您进入Add Reference...时,是否显示"Microsoft Solver Foundation" ?

如果没有,也许您没有使用正确的框架,请尝试Project -> Properties.. -> Compile -> Advanced Compile Options...并证明您没有使用.NET 4 Framework Client Profile(用于新项目的默认值)。如果是,修改为.NET 4 Framework

如果这也失败了…你下载并安装解算器了吗?

您需要将对找到的DLL的引用添加到您的项目中。

最新更新