In the article on working with NuGet packages we considered all the specific features of using with Fast Reports software. One of the most frequent questions of our clients is the following one:Â
How do we install your licence packages in our product using Linux, MacOS or Windows so that we wonât have to install the latest update of FastReport products manually by installer that has been downloaded from the website compatible only with Windows?
To answer this question, we have prepared a comprehensive decision such as our Fast Reports Private NuGet-server.
Almost all packages you use in your projects are stored in public package registry - NuGet Gallery (nuget.org). Here you can find different demo versions of our packages, however there are no full packages that are not limited by demo versions. Thatâs why we have decided to create our package registry available only for Fast Reports clients. Hence you need a Fast Reports account to have an access to it (via this account you could go to cpanel.fast-report.com for downloading the product installer).
We consider several types of adding our NuGet-server:
But at first, we should speak about differences of a global and a local NuGet Config.
Consider the restoring of packages used in your project:
1) NuGet looks for necessary packages in the cache
2) NuGet looks for necessary packages in all the sources added to the NuGet.Config file, and:
a) NuGet addresses to the local NuGet.Config
b) NuGet addresses to the global NuGet.Config
The local NuGet.Config is situated near your project. So, sources that have been added here will be used only for restoring this project.
In its turn, the global NuGet.Config will be used for all projects of this computer. However, it is necessary not for all projects.
Global NuGet.Config location:
Windows: "C:\Users\{Userâs_name }\AppData\Roaming\NuGet\NuGet.Config"
MacOS: "~/.config/NuGet/NuGet.Config"
Linux: â~/.config/NuGet/NuGet.Configâ
Thus, according to NuGet specification, the serverâs name, its address and your data (email and password to this server) must be written in a file named NuGet.Config (or nuget.config) that will be situated in a place suitable for you.
A file of NuGet.Config is able to store a source password in encrypted way as well as in the format of ClearTextPassword. In most cases it is recommended to store passwords encrypted, however at the same time encrypting is made with the help of external environment parameters (operating system, computer configuration, etc.). As a consequence, if we distribute this configuration file to another machine, the mentioned password canât be decoded and you wonât get access to the source. It should be taken into account when choosing types of adding or updating the source.
Then we study principal methods to add our source to NuGet with specifying operating system compatible with this particular method. In addition, we wonât forget about available types of configurations and source password storage format.
(any OS, any config, any password storage format)
Downloaded SDK .NET Core 3.1.200 and later (including SDK .NET 5 and later) is necessary for this method to work out. Put in the command prompt:
dotnet nuget add source https://nuget.fast-report.com/api/v3/index.json --name [choose source name without spaces, for example: fr_nuget] --username [email of your Fast Reports account] --password [password from your Fast Reports account]
By default, this command adds a source to the global NuGet.Config, but you can choose the location of the configuration file and make it local with the help of --configfile parameter [configuration file path].
The source password is also encrypted by default, and --store-password-in-clear-text parameter is necessary to store non-encrypted password.
Example:
dotnet nuget add source https://nuget.fast-report.com/api/v3/index.json --name fr_nuget --username myaccount@fast-report.com --password 1234Password5678
You can read more about this method of adding a source on the Microsoft website.
(Windows, global config, encrypted password)
Consider adding NuGet-server using Microsoft Visual Studio 2022 by means of an example. It is important to take into account that this method works out starting from Visual Studio 2017. In menu choose âToolsâ, then âNuGet Package Managerâ and open the âPackage Manager Settingsâ window.
Then on the left choose âPackage Sourcesâ and click + (add) button.
Put the name source in âNameâ field without spaces (for example, FastReport-NuGet) and the source address https://nuget.fast-report.com/api/v3/index.json in âSourceâ field
Press âĐĐâ and after that shift to a package adding window.
In the drop-down list âPackage sourceâ choose the source we have just added. Then in the dialog box fill in Fast Reports account data and tick âRemember my passwordâ.
(macOS, global config, encrypted password)
Consider using the example of Microsoft Visual Studio for Mac 2019.
In the menu choose âProjectâ and open âManage NuGet PackagesâŠâ window.
At the bottom of the drop-down list âPackage sourceâ choose âConfigure SourcesâŠâ.
Press Add button and fill in the data in the window:
- Name: source name without spaces (for example, FastReport-Nuget);
- Location: https://nuget.fast-report.com/api/v3/index.json ;
- Username: email from Fast Reports account;
- Password: password from Fast Reports account.
Confirm adding the source by âAdd Sourceâ button.
(any OS, global config, encrypted password)
Consider using the example of Rider 2021.3 in Linux Ubuntu 18.04.
Go to the menu âToolsâ, âNuGetâ and choose âShow NuGet Sourcesâ.
Press + in the NuGet window in âSourcesâ in front of âNew feedâ
Enter necessary data:
- Name â source name without spaces (for example, FastReport-Nuget);
- URL - https://nuget.fast-report.com/api/v3/index.json ;
- User - email from Fast Reports account;
- Password â password from Fast Reports account.
(any OS (Mono 4.4.2 or later is necessary for macOS/Linux), any config, any password storage type)
Nuget.exe installation is described in detail on Microsoft website. Now we consider just important features.
nuget sources add -name [choose the source name without spaces, for example: fr_nuget] -source âhttps://nuget.fast-report.com/api/v3/index.jsonâ -username [email of your Fast Reports account] -password [password of your Fast Reports account]
By default, this command adds the source in the global NuGet.Config, however you can choose the location of the configuration file and make it local using -ConfigFile parameter (configuration file path).
Initially a source password is encrypted, and -StorePasswordInClearText parameter is used to store a non-encrypted password
Example:
nuget sources add -name fr_nuget -source âhttps://nuget.fast-report.com/api/v3/index.jsonâ -username myaccount@fast-report.com -password 1234Password5678
You can read more about this method of adding a source on the Microsoft website.
(any OS, any config, non-encrypted password)
Important! It is only non-encrypted password from Fast Reports account that you can enter using this method, as the configuration file is a simple XML file. Any text editor opens or creates it. In the block âpackageSourcesâ it is necessary to add our resource with chosen name (it is undesirable to use spaces), for example:
<add key="FR-NuGet" value="https://nuget.fast-report.com/api/v3/index.json" />
In the block âpackageSourceCredentialsâ it is necessary to add your email and password from Fast Reports account in the block with the same key:
<FR-NuGet> <add key="Username" value="myaccount@fast-report.com" /> <add key="ClearTextPassword" value="1234Password5678" /> </FR-NuGet>
Finally, youâll get a similar configuration file (other sources have been removed from the example):
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="FR-NuGet" value="https://nuget.fast-report.com/api/v3/index.json" /> </packageSources> <packageSourceCredentials> <FR-NuGet> <add key="Username" value="myaccount@fast-report.com" /> <add key="ClearTextPassword" value="1234Password5678" /> </FR-NuGet> </packageSourceCredentials> </configuration>
(any OS, any config, non-encrypted password)
In Dockerfile when creating docker-image you need to add a source either by using .NET CLI, or by placing NuGet.Config configuration file, that has been prepared before, in a docker-container. As a mean of example, we use .NET CLI in Dockerfile to add a source.
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build ARG username ARG pass RUN dotnet nuget add source https://nuget.fast-report.com/api/v3/index.json --name fr_nuget --username $username --password $pass --store-password-in-clear-text
Now when running docker build command we just give necessary parameters:
docker build -f "./DockerTestProject/Dockerfile" --force-rm --build-arg username=myaccount@fast-report.com --build-arg pass=1234Password5678 -t dockertest:latest
Attention! This method of transferring private keys and passwords is not secure. You can read a corresponding article on more secure transferring passwords as docker build arguments.
If your account data changed, you need to update it in the NuGet configuration file. Consider following methods:
In JetBrains Rider and Microsoft Visual Studio for Mac changing user data is similar to adding; the only adjustment is that it is necessary to update a source you have already added. In case of connection via Docker in the method of adding mentioned above it suffices to change user data when assembling a container from Dockerfile.
(any OS, any config, any password storage method)
Installed SDK .NET Core 3.1.200 and later (including.NET 5 and later) is necessary for this method to work out. Put in the command prompt:
dotnet nuget update source [the name of resource that has been added before, for example: fr_nuget] --username [email of your Fast Reports account] --password [password of your Fast Reports account]
This command is considered to change a source that has been added to the global NuGet.Config. However, you can choose the location of the configuration file by using --configfile parameter (configuration file path). By default, the source password is encrypted, you can use --store-password-in-clear-text parameter to store non encrypted password
You can read more about this method of updating the source on the Microsoft website.
(any OS (Mono 4.4.2 or later is required for macOS/Linux), any config, any password storage type)
Nuget.exe installation was described previously in detail. It suffices only to consider key features.
nuget sources update -name [name of the source that has been added before, for example: fr_nuget] -username [email of your Fast Reports account] -password [password of your Fast Reports account]
Initially this command changes the source added in the global NuGet.Config. However, you can choose the location of configuration file using the -ConfigFile parameter (configuration file path).
By default, a password is encrypted, -StorePasswordInClearText parameter is used to store a non-encrypted password.
You can read more about this method of updating the source on the Microsoft website.
(any OS, any config, non encrypted password)
Open a necessary file of NuGet.Config via any text editor. In the block âpackageSourceCredentialsâ with the name of the source that has been added before we change values âUsernameâ and âClearTextPasswordâ to necessary ones. If instead âClearTextPasswordâ you have the block âPasswordâ, just change it to âClearTextPasswordâ. Finally, it should look as follows:
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="FR-NuGet" value="https://nuget.fast-report.com/api/v3/index.json" /> </packageSources> <packageSourceCredentials> <FR-NuGet> <add key="Username" value="myaccount@fast-report.com" /> <add key="ClearTextPassword" value="MyNewPassword5678" /> </FR-NuGet> </packageSourceCredentials> </configuration>
By default, in the interface of your IDE you see all the packages downloaded in Fast Reports private NuGet source. However, to download a selected package the next requirement should be met: if the package is not public available (such as FastReport.Compat, FastReport.Core demo version, FastReport.Net.Demo, etc.), you need to have a necessary subscription to download the latest updates of these packages.
For example, to download FastReport.Core you need to have a subscription not earlier than FastReport .NET Standard (including Professional, Enterprise or Ultimate), to download FastCube.Core you need a subscription not earlier than FastCube .NET Standard (including Professional or Ultimate), etc.
If your subscription has expired, you can keep using Fast Reports packages source, however you will have no access to the latest versions of packages. As a consequence, the latest available version of the package will be determined by the following condition:
Date of selected version release < date of necessary subscription expiryÂ
Important! When trying to download a package with the release date later than necessary subscription expiry date, Fast Reports NuGet server will provide you with the latest available version of the package based on your subscription. But we donât recommend a link to unavailable package version, as it leads to Warning notification when restoring a project and delay of package downloading.