准备您的 Microsoft Visual Studio 环境
在开始使用 MATLAB® Production Server™ .NET 客户端库编写 .NET 客户端程序之前,请完成以下步骤来准备您的开发环境。
创建 Microsoft Visual Studio 工程
打开 Microsoft® Visual Studio®。
点击 File > New > Project。
在新建工程对话框中,选择要使用的模板。例如,如果您想在 Visual Studio 2017 中创建一个 C# 控制台应用程序,请在左侧导航窗格中选择 Visual C# > Windows Desktop,然后选择 Console App (.Net Framework)。
在 Name 字段中输入工程的名称(例如,
Magic
)。点击确定。您的
Magic
源 shell 已创建,默认情况下通常名为Program.cs
。
添加对 .NET 客户端库的引用
要使用 MATLAB Production Server .NET 客户端库中定义的类和方法,请在 Microsoft Visual Studio 工程中创建对该库的引用。
在 Microsoft Visual Studio 内的 Solution Explorer 窗格中(通常在右侧),右键点击您的
Magic
工程,选择Add > Browse。浏览到 MATLAB Production Server .NET 客户端运行时库位置。
在本地 MATLAB Production Server 安装中,库位于
,其中$MPS_INSTALL
\client\dotnet
是安装 MATLAB Production Server 的位置。选择$MPS_INSTALL
MathWorks.MATLAB.ProductionServer.Client.dll
文件。客户端库也可以从以下网址下载:
https://www.mathworks.com/products/matlab-production-server/client-libraries.html
。点击确定。您的 Microsoft Visual Studio 工程现在引用了
MathWorks.MATLAB.ProductionServer.Client.dll
。