Fast Reports Private NuGet-server

2022-02-15

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.

Fast Reports NuGet Server

What is that and what is that for?

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).


Adding a source

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.


Global and 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.


Encrypted and non-encrypted password storage 

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.


.NET CLI:

(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.


Microsoft Visual Studio:

(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.

Visual Studio 2022 window

Then on the left choose ‘Package Sources’ and click + (add) button.

NuGet sources manager window

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.

Entering Fast Reports account data

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’.

Adding NuGet-packages in a project


Microsoft Visual Studio for Mac:

(macOS, global config, encrypted password)

Consider using the example of Microsoft Visual Studio for Mac 2019.

Visual Studio for Mac 2019 window

In the menu choose ‘Project’ and open ‘Manage NuGet Packages…’ window.

NuGet sources manager window

At the bottom of the drop-down list ‘Package source’ choose ‘Configure Sources…’.

Adding a new source and entering Fast Reports account data

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.

Adding NuGet-packages to a project


JetBrains Rider:

(any OS, global config, encrypted password)

Consider using the example of Rider 2021.3 in Linux Ubuntu 18.04.

Rider 2021.3 window

Go to the menu ‘Tools’, ‘NuGet’ and choose ‘Show NuGet Sources’.

NuGet sources panel

Press + in the NuGet window in ‘Sources’ in front of ‘New feed’

Adding a new source and entering Fast Reports account data

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.

Adding NuGet-packages in a project


Nuget.exe CLI:

(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.


Edit NuGet.Config:

(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>


Docker:

(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.


Updating login/password

If your account data changed, you need to update it in the NuGet configuration file. Consider following methods:

  • .NET CLI;
  • nuget.exe CLI;
  • NuGet.Config.

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.


.NET CLI:

(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.


Nuget.exe CLI:

(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.


Edit NuGet.Config:

(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>


More detail on downloading packages

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.


Restoring packages in case of an expired subscription 

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.

November 20, 2024

Localization and Language Switching in FastReport VCL

FastReport VCL supports 40 languages for interface localization and allows you to change the language on the fly through menus or code, without recompilation.
November 01, 2024

New Features of the FastReport VCL Editor

We are considering new features of the report editor: extension lines, highlighting of intersecting objects, updated report and data trees.
October 30, 2024

Using Styles When Creating Reports in FastReport VCL

The article discusses one of the new features of FastReport VCL — the use of styles and style sheets.
Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 66 Canal Center Plaza, Ste 505, Alexandria, VA 22314

© 1998-2024 Fast Reports Inc.