Hangfire Pro Downloads
Hangfire Pro packages are hosted on a private ProGet Server. Package downloads are available only for Hangfire Pro subscribers. After paying, you’ll instantly receive a link to download the Hangfire Pro binaries (non-NuGet based). Please give me 24 hours to generate your credentials for private NuGet server.
- Hangfire.Pro – batches and batch continuations to create a bunch of background jobs atomically as well as add continuation after all batch jobs executed.
- Hangfire.Pro.Redis – ultra-fast job storage for Hangfire based on key-value store Redis.
- Hangfire.Pro.PerformanceCounters – allows Hangfire to publish its metrics to Windows Performance Counters – the standard way to monitor Windows applications and services.
There are several ways to add a NuGet feed, but the main difficulty is authentication. In modern environments with NuGet 3.5+ it is possible to use environment variables to provide credentials, and it is the best way, since you’ll have the same configuration for both development machines and build servers, and for all environments, including .NET Core projects.
Simple Setup in Visual Studio
This is the simplest way to start using Hangfire Pro feed, but it will not work with Continuous Integration. To configure a private feed in Visual Studio, open Tools → NuGet Package Manager → Package Manager Settings and add a new feed with the following URL:
Apples to: Visual Studio 2017, .NET Core CLI, NuGet.exe 3.5+. This will also work in Visual Studio 2015, but you’ll be prompted for credentials each time you install a package, when HangfirePro feed is selected.
Create a new file called
NuGet.config in the root directory of your solution, and add the following contents.
<!-- YourSolution\NuGet.config --> <configuration> <packageSources> <add key="HangfirePro" value="https://nuget.hangfire.io/nuget/hangfire-pro/" /> </packageSources> <packageSourceCredentials> <HangfirePro> <add key="Username" value="%HANGFIRE_LOGIN%" /> <add key="ClearTextPassword" value="%HANGFIRE_PASSWORD%" /> </HangfirePro> </packageSourceCredentials> </configuration>
The changes will take an effect only when you close the solution and re-open it. You can safely add this file to the solution control, since it does not contain any sensitive data. It’s better to set environment variables for credentials then, to not to specify them each time.
Setting environment variables
On Windows, use the
setx command to add the corresponding environment variables. It’s also possible to set machine-wide variables using the
/s switch. Alternatively you can set them using the System properties window, but don’t forget to reopen the command prompt to use the new values.
setx HANGFIRE_LOGIN your_login setx HANGFIRE_PASSWORD your_password
On *nix systems it depends on your shell program. You can use the following commands to set environment variables when using Bash.
export HANGFIRE_LOGIN=your_login export HANGFIRE_PASSWORD=your_password
In TeamCity, use Build Parameters, in AppVeyor use secure variables in your
appveyor.yml file, in Travis CI it’s possible to use encrypted variables too. I believe other continuous integration servers also have an encryption feature.
Package not found: close the solution and open it again. 401 unauthorized status returned: ensure your environment variables are set and use correct credentials. If package restore prompts for credentials, ensure environment variables are set, and you have the latest version of the NuGet client:
> NuGet.exe help ... NuGet Version: 126.96.36.1996
If your version less than the specified one, just update the NuGet client:
NuGet.exe update -self
If you have any problems with the setup, send an email to firstname.lastname@example.org, I’ll be happy to help.
Build servers with NuGet < 3.5
Alternatively, you can run the following command to add a new package source using command line:
nuget sources add -Name "HangfirePro" -Source https://nuget.hangfire.io/nuget/hangfire-pro -UserName user -Password secret
After configuring private NuGet feed, use your favourite method to install Hangfire Pro NuGet packages.
Package Manager Console
The Package Manage Console can be opened in Visual Studio through
Library Package Manager →
Package Manager Console.
PM> Install-Package Hangfire.Pro
Package Manager Dialog (Visual Studio)
- Right-click on your project and click “Manage NuGet Packages”.
- Select “NuGet Offical Package Source”
- Search for “Hangfire”, using the search bar at the top right
- Select “Hangfire” and choose Install