在 C# 中使用 Microsoft Solver Foundation
我正在尝试在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您从未提到过您在项目中添加了对此库的引用,并且您所描述的行为与未添加引用是一致的。因此,您还需要添加引用 到这个库到你的项目。
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.
我之前已经尝试过添加参考文献,但它不起作用。现在我注意到警告中的一些内容(我以前可能没有看到):
我通过设置“应用程序属性”->“解决了这个问题”。应用->目标框架从“.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):
I fixed this by setting Application Properties -> Application -> Target Framework from ".Net Framework 4 Client Profile" to ".Net Framework 4".
当您转到
添加引用...
时,是否会显示“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?
您需要将对找到的 DLL 的引用添加到您的项目中。
You need to add a reference to that DLL you found to your project.