Not everyone who creates automations with Blue Prism may have come across the term, NuGet. In fact, you may have only come across NuGet if you are a code stage creator or, in effect, a NET developer. In this blog, we explore this source of NET packages that can be used in Blue Prism integrations.
NuGet? What’s that then?
When you develop computer software its very useful to have a mechanism with which to create, share and make use of existing code. This code is assembled into packages which are compiled usually as DLLs (dynamic link libraries) along with other content that the projects need to use these packages.
When you create code with Blue Prism, chances are you are using either C# or VB.NET. So, having access to NuGet is a big benefit. This document aims to answer how to make the best use of NuGet if you are creating Blue Prism code stages.
NuGet exists on the web at https://www.nuget.org. At the time of writing, the landing page looks like this.
Almost 300,000 unique packages and many billions of individual downloads make NuGet one of the most popular package repositories on the internet.
The NuGet Package
This is the unit of download that is provided by the NuGet repository. The file has the extension of nupkg. A short form for NuGet Package. These packages are just zip files and if you change the extension to .zip, you will find that the file can be readily opened and viewed. This allows you to move the package element, specifically the DLLs, to where you need them to be.
There is no direct way to use NuGet with Blue Prism, however if you like many developers, you create your code-stage code in either Visual Studio, VS Code or JetBrains Rider and use the advantages of those development IDE’s and then transfer your code to Blue Prism when you are satisfied with its functionality. It is in that IDE that you can take advantage of NuGet.
In Visual Studio, it looks like this:
The left screen section is showing a set of packages and the right area is showing your solution and whether the selected package is installed there.
The benefit of a package manager, like NuGet, is the ability to make use of functionality that has been created and tested by many other developers. The other win is these packages are generally maintained by this we mean kept up to date and bugs are dealt with and even new features added.
Blue Prism & NuGet
As an example, let’s use the Prism.Core package. Prism is a framework mainly for building composite applications. If you are familiar with WPF (Windows Presentation Foundation) you will likely be aware of Prism. Please note, it has no connection to Blue Prism, the name is a complete coincidence.
So, here is our example, Prism.Core.
So, we have our code-stage code in our IDE and now we are looking to move this over to Blue Prism. We need to get any NuGet package DLLs into a position where Blue Prism can access them.
As previously mentioned, NuGet packages are zip files. So, we rename the package with the zip extension and then open it up or extract its contents.
The opened zip (nupkg).
If we follow the directory chain from the lib folder, down we will eventually find some DLLs.
The Prism.dll is the file that we would like Blue Prism to be able to access and the easiest way to do this is to copy it to the Blue Prism application folder inside of Program Files.
So, we now make the transition to Blue Prism and provide access to the DLL from there.
So, if we open a new Blue Prism object, and then visit the properties of that object we can tell Blue Prism where the DLL is that we want to use. In addition we also tell Blue Prism the specific namespaces that we want to use, show above in the lower part of the image.
So, we have come a long way. We know now about software repositories and what they are and how they are used and what benefits they bring. We have also seen how a NuGet package can be downloaded and made available for Blue Prism to use and how to accomplish this.