Developer Update

MIP SDK Samples on GitHub

Card image
Hans Kierulff

Developer Advocate

February 25, 2021
We just released the MIP SDK Samples on GitHubThis means that from now on, you can use more modern and familiar ways of working with the whole MIP SDK. This includes learning from and working with the MIP SDK Samples, now publicly available on GitHub, which we will describe in more detail in this article. 
GitHub is a broadly used and popular public cloud platform for hosting source code under version control and with a huge set of source code management features. Milestone has created an account on GitHub and has made three repositories (aka “repos”) there, comprising the MIP SDK Sample code. 

Repositories

mipsdk-samples-component: Samples showcasing how you can integrate stand-alone applications utilizing the MIP .NET libraries.

mipsdk-samples-plugin: Samples showcasing how you can let the MIP environment in XProtect Management Client, Event Server or Smart Client host your application.

mipsdk-samples-protocol:  Samples showcasing how you can integrate applications for non-Windows operating systems with a XProtect VMS utilizing the MIP protocol APIs.

This means the MIP SDK Sample code is now public available for searches, download, and use. We hope this will ease your utilization of the MIP SDK Samples!

There exists a huge number of tools and features that can help you get the most out of GitHub. In this article, I will, however, only describe a few tools I use myself.

While you can always use your browser to find a piece of sample code and copy-paste that into your solution, our intended use of the MIP SDK Samples on GitHub is that you copy the MIP SDK Samples on GitHub down to your development box and work with them there.

If you install one of the GitHub tools on your development box, you have a very feature-rich source- and version control available, which you, in this case, can use to see and manage the changes you have made to the MIP SDK Samples locally.
The tools
Besides the browser, downloading the samples as a .zip is probably the simplest way to copy the MIP SDK Samples. To do that, you have to use the green Code button.
If you, however, install one of the Git tools, you can both download (clone) the MIP SDK Samples, change them locally under source control, and merge any later updates there might come to the MIP SDK Samples into your local version.

There are many commands available when working with GitHub. This page describes clone, which is the most important command to get started with, as it “grab a complete copy of a MIP SDK Sample repository to a local repository on your computer”. The code in the local repository is under source control, so you can change it, and commit the changes, and by that creating new local versions.

To get started, I created a user account on GitHub, and installed GitHub Extension for Visual Studio in my Visual Studio. Now I can use Visual Studio to clone remote repositories on GitHub down to my box and manage it from there.
My first clone
I wanted to work with MIP SDK Component Integration Samples, so I navigated to https://github.com/milestonesys/mipsdk-samples-component and clicked "Code" and then "Open" with Visual Studio.
Visual Studio now opens and propose a local path for the cloned repository: 
Click Clone, and your local copy of the repository will be created.

From here on, you can work with the MIP SDK Samples, as you are used to. For example, to work with the ConfigAPIBatch sample, navigate to the local folder (in this case) C:\Users\hki\source\repos\mipsdk-samples-component\ConfigAPIBatch and open ConfigAPIBatch.csproj. This opens a new instance of Visual Studio you can use to edit and build the sample.

When you edit the sample, note it is under Git’s source control by the small red checkmark symbol on the edited Program.cs file and the other files having a blue lock symbol. Right-clicking on the file will show a Git menu item, with relevant options for the file at this time, ex. Compare or see the History. With the Git main-menu entry, you can Commit your changes to a new local version and Pull any changes there might have been done to the original repository in the cloud down to your local version.
The MIP SDK Samples repositories are for now closed for direct contribution (like branching, pushing and creating pull-requests) so in case you want to comment on or contribute to the samples, please reach out through the Milestone Developer Forum.

Talking about version- and source code management systems, I can only highly recommend you to use one, being your own account on GitHub or any other, to manage the software you build!
NuGet PackageReferences
The MIP SDK Sample projects utilizes PackageReferences to reference the MIP VideoOS. assemblies on NuGet. Read more here NuGet PackageReference format (package references in project files) | Microsoft Docs (and note that when you create your own projects, they’ll probably default to packages.config, as it is .NET Framework projects).

When you build the project, the reference node becomes populated with the PackageReferences:
Now, the sample is ready to explore!


Stay up to date


As of February 2021: 
  • MIP SDK .NET Framework binaries are publicly available at NuGet
  • MIP SDK Samples are publicly available at GitHub
  • You can hence work with the MIP SDK without downloading and running the classic MIP SDK Installer. While this is true, there is a few tools that are still only available in the traditional MIP SDK installer, like StableFPS, MDepend and Tray Tool. These tools will later get packaged in separate installers.
  • The “classic” MIP SDK installer will be discontinued at a later time.
  • The MIP Mobile SDK will later be published on relevant public distribution platforms in a similar fashion