在 C# 中使用 Microsoft Solver Foundation

发布于 2024-11-23 19:16:00 字数 454 浏览 2 评论 0原文

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

using Microsoft.SolverFoundation;

但是,我收到错误“命名空间“Microsoft”中不存在类型或命名空间名称“SolverFoundation” ’”。

我看到 C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0 中有 Microsoft.Solver.Foundation.dll

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

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

I'm trying to use Microsoft Solver Foundation in my C# application in VS2010 Ultimate. I've installed MSF (64 bit version) and as far as I understand I should be able to use the services after declaring:

using Microsoft.SolverFoundation;

However, I get the error "The type or namespace name 'SolverFoundation' does not exist in the namespace 'Microsoft'".

I see that there's Microsoft.Solver.Foundation.dll located in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0

Initially I thought the 64 bit version might be the problem so I uninstalled and switched to the 32 bit version. But no success either.

How can I integrate MSF into my C# application?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

情深缘浅 2024-11-30 19:16:00

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

using Microsoft.SolverFoundation;

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

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

I'm trying to use Microsoft Solver Foundation in my C# application in VS2010 Ultimate. I've installed MSF (64 bit version) and as far as I understand I should be able to use the services after declaring:

using Microsoft.SolverFoundation;

How can I integrate MSF into my C# application?

At no point did you mention that you added a reference to this library to your project, and the behavior you are describing is consistent with not having added a reference. Therefore, you also need to add a reference to this library to your project.

心如荒岛 2024-11-30 19:16:00

我之前已经尝试过添加参考文献,但它不起作用。现在我注意到警告中的一些内容(我以前可能没有看到):

"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 Client Profile”到“.Net Framework 4”。

I've already tried adding the references before but it wouldn't work. Now I've noticed something in the warnings (which I probably didn't see before):

"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."

I fixed this by setting Application Properties -> Application -> Target Framework from ".Net Framework 4 Client Profile" to ".Net Framework 4".

萌能量女王 2024-11-30 19:16:00

当您转到添加引用... 时,是否会显示“Microsoft Solver Foundation”?

如果没有,也许您没有使用正确的框架,请尝试 Project ->属性.. ->编译->高级编译选项... 并证明您没有使用 .NET 4 Framework Client Profile(用于新项目的默认设置)。如果是,请将其更改为 .NET 4 Framework

如果这也失败了...您是否下载并安装了求解器?

Does "Microsoft Solver Foundation" show up when you go to Add Reference...?

If it does not perhaps you are not using the correct framework, try Project -> Properties.. -> Compile -> Advanced Compile Options... and certify you are NOT using .NET 4 Framework Client Profile (uses to be default for new projects). If it is, change it to .NET 4 Framework.

If that also fails... have you downloaded and installed the solver?

感情洁癖 2024-11-30 19:16:00

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

You need to add a reference to that DLL you found to your project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文