HyperX.Solver.Api 1.23.0
The HyperX Solver Application Programming Interface
Loading...
Searching...
No Matches
Quick Start: Command Line Interface

Make sure you have the .NET 8 SDK installed on your machine.

To build a criterion, you'll need to reference the HyperX Solver API assembly. The assembly is available as a C# nuget package included in the main HyperX install.

Use the following commands to create a new directory and initialize a nuget configuration.

mkdir myproject
cd myproject
dotnet new nugetconfig

Open the nuget.config file generated by the last command and replace the contents with the following. This makes the .nupkg files shipped with the HyperX installer available to nuget. You may wish to remove the <clear /> commands if you use additional nuget packages.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<!-- Replace the value below with the path to your hyperx install directory. -->
<!-- You may copy the .nupkg files out of the installation and into another folder for easier access. -->
<!-- This path may be relative. -->
<add key="hx nuget" value="REPLACE-WITH-HYPERX-INSTALL-DIR\Code\nuget" />
</packageSources>
<packageSourceMapping>
<clear />
<packageSource key="hx nuget">
<!-- HyperX packages allowed from hyperx install -->
<package pattern="HyperX.*" />
<package pattern="hxpkg" />
</packageSource>
</packageSourceMapping>
</configuration>

Install the HyperX packaging tool:

dotnet new tool-manifest
dotnet tool install hxpkg

Initialize the package config and create a criterion module. The following commands automatically add a reference to the HyperX Solver API in the generated .csproj file.

dotnet tool run hxpkg init
dotnet tool run hxpkg add criterion

Optionally modify the version reference to control the exact API version you are developing against. The nuget package version must be available in your nuget.config file. View the Solver API version of your HyperX install with: Ribbon | Database | Packages | Package Manager | Settings

<PackageReference Include="HyperX.Solver.Api" Version="1.23.0" />

Optionally add 'extra versions' of the API to compile against. You must also reference these in the module.mains portion of the hxpkg.config file. You can use SOLVER_X_Y_OR_GREATER preprocessor definitions to conditionally enable code depending on which Solver API you are running against.

<PackageReference Include="HyperX.Solver.Api" Version="1.23.0" ExtraVersions="1.1.0;1.2.0" />

Optionally modify whether the package should be generated on build.

<GenerateHxpkgOnBuild>true</GenerateHxpkgOnBuild>

Build the project.

dotnet build --tl:off

In the build standard output, you should see a message indicating that the package has been built:

1>Successfully created package 'company.package.0.0.0.hxpkg'
Note
If building against multiple Solver API versions and dotnet build fails because msbuild is not available, try building in Visual Studio.
Visual Studio's Developer Powershell and UI controls will substitute its own MSBuild when the .NET development workload is installed.

You can install this package in the HyperX Package Manager (Ribbon | Database | Packages | Package Manager) by adding a package source for its directory and installing it.

To further modify this code, use your preferred C# code editor.