主要内容

本页采用了机器翻译。点击此处可查看最新英文版本。

准备您的 Microsoft Visual Studio 环境

在开始使用 MATLAB® Production Server™ .NET 客户端库编写 .NET 客户端程序之前,请完成以下步骤来准备您的开发环境。

创建 Microsoft Visual Studio 工程

  1. 打开 Microsoft® Visual Studio®

  2. 点击 File > New > Project

  3. 在新建工程对话框中,选择要使用的模板。例如,如果您想在 Visual Studio 2017 中创建一个 C# 控制台应用程序,请在左侧导航窗格中选择 Visual C# > Windows Desktop,然后选择 Console App (.Net Framework)

  4. Name 字段中输入工程的名称(例如,Magic)。

  5. 点击确定。您的 Magic 源 shell 已创建,默认情况下通常名为 Program.cs

添加对 .NET 客户端库的引用

要使用 MATLAB Production Server .NET 客户端库中定义的类和方法,请在 Microsoft Visual Studio 工程中创建对该库的引用。

  1. 在 Microsoft Visual Studio 内的 Solution Explorer 窗格中(通常在右侧),右键点击您的 Magic 工程,选择Add > Browse

  2. 浏览到 MATLAB Production Server .NET 客户端运行时库位置。

    在本地 MATLAB Production Server 安装中,库位于 $MPS_INSTALL\client\dotnet,其中 $MPS_INSTALL 是安装 MATLAB Production Server 的位置。选择 MathWorks.MATLAB.ProductionServer.Client.dll 文件。

    客户端库也可以从以下网址下载:https://www.mathworks.com/products/matlab-production-server/client-libraries.html

  3. 点击确定。您的 Microsoft Visual Studio 工程现在引用了 MathWorks.MATLAB.ProductionServer.Client.dll

另请参阅

主题