Skip to content

Generating Nuget Packages

Chris Barth edited this page Mar 8, 2019 · 5 revisions

The Mixed Reality Toolkit Packaging Story

Contributors to the Mixed Reality Toolkit are in the process of setting up a more robust packaging story for distributing components. Tooling for creating NuGet packages is still under construction. The most recent instructions can be found below.

Note: Building the artifacts is NOT currently a required step in validating new contributions to the Mixed Reality Toolkit. Long term, after this new packaging story is completed, building the artifacts will become a required step in validating changes.

Building the Artifacts

Requirements

NuGet

NuGet is the package manager for .Net. You will need to declare the directory containing nuget.exe in your windows PATH variable in order for nuget.exe to resolve correctly in the below PowerShell build script.

After installing NuGet, you can add it to your PATH variable via the following:

  1. Open 'Edit your system environment variables' from the windows start menu
  2. In the 'System Properties' Dialogue, select the Advanced tab
  3. Select the 'Environment Variables...' button
  4. Find 'Path' under your user variables
  5. Choose to 'Edit' the 'Path' variable value
  6. Add a 'New' item to the 'Path' variable that is the directory where nuget.exe is located
  7. Reopen any PowerShell windows
  8. Confirm nuget now resolves as a command in your PowerShell window by running 'get-command nuget'

Note 1: Command Window and PowerShell both resolve PATH variables when opened. Any changes to the PATH variable will require closing and reopening Command and PowerShell windows for things to resolve correctly.

Note 2: Further steps will show how to build NuGet packages related to the MRTK. You can also build your own NuGet packages in a command window by running the following:

nuget pack package.nuspec -Symbols

UnitySetup

The build process leverages UnitySetup, an OSS PowerShell Module from Microsoft.

Install from PowerShell:

Install-Module UnitySetup -Scope CurrentUser

Git

If you do not specify a version, then Git is used to find relevant tags. In this case it will need to be available in the PATH. See the above instructions for setting up NuGet to understand how to set the PATH variable for Git.exe

Run the Build

Simply execute the build script as such:

.\build.ps1 -Version '1.2.3'

For help and examples simply use the PowerShell help command:

help .\build.ps1 -Detailed

Note: If you don't specify -Version <version> the script will try to infer it from tags pointing to the current git commit. An error is produced if you don't have a tag and no version is provided.