Skip to main content

VelopackLocator class

Namespace: Velopack.Locators

A base class describing where Velopack can find key folders and files.

public abstract class VelopackLocator : IVelopackLocator

Implements: IVelopackLocator

Constructors​

ConstructorSummary
VelopackLocator

VelopackLocator()​

protected VelopackLocator()

Properties​

PropertySummary
IsCurrentSetCheck if a VelopackLocator has been set for the current process.
CurrentGet the current locator in use, this process-wide locator can be set/overridden during VelopackApp.Build().
AppIdThe unique application Id. This is used in various app paths.
RootAppDirThe root directory of the application. On Windows, this folder contains all
PackagesDirThe directory in which nupkg files are stored for this application.
AppTempDirThe temporary directory for this application.
UpdateExePathThe path to the current Update.exe or similar on other operating systems.
AppContentDirThe directory in which versioned application files are stored.
ChannelThe release channel this package was built for.
AppUserModelIdThe Application User Model ID for this app, used for taskbar grouping and toast notifications on Windows.
LogThe logging interface to use for Velopack diagnostic messages.
IsPortableA flag indicating if this is a portable build, and that the settings should be self-contained in the package.
ProcessProvides an abstraction for dealing with the dotnet Process API. This is used to start processes and
ThisExeRelativePathThe path from AppContentDir to this executable.
CurrentlyInstalledVersionThe currently installed version of the application, or null if the app is not installed.

IsCurrentSet​

public static bool IsCurrentSet { get; }

Check if a VelopackLocator has been set for the current process.

Current​

public static IVelopackLocator Current { get; }

Get the current locator in use, this process-wide locator can be set/overridden during VelopackApp.Build(). Alternatively, most methods which use locators also accept an IVelopackLocator as a parameter.

AppId​

public abstract string? AppId { get; }

The unique application Id. This is used in various app paths.

RootAppDir​

public abstract string? RootAppDir { get; }

The root directory of the application. On Windows, this folder contains all the application files, but that may not be the case on other operating systems.

PackagesDir​

public abstract string? PackagesDir { get; }

The directory in which nupkg files are stored for this application.

AppTempDir​

public virtual string? AppTempDir { get; }

The temporary directory for this application.

UpdateExePath​

public abstract string? UpdateExePath { get; }

The path to the current Update.exe or similar on other operating systems.

AppContentDir​

public abstract string? AppContentDir { get; }

The directory in which versioned application files are stored.

Channel​

public abstract string? Channel { get; }

The release channel this package was built for.

AppUserModelId​

public virtual string? AppUserModelId { get; }

The Application User Model ID for this app, used for taskbar grouping and toast notifications on Windows.

Log​

public virtual IVelopackLogger Log { get; }

The logging interface to use for Velopack diagnostic messages.

IsPortable​

public virtual bool IsPortable { get; }

A flag indicating if this is a portable build, and that the settings should be self-contained in the package. On Windows, this is true for portable builds, and false for non-portable builds which were installed by Setup.exe On OSX and Linux, this is always false, because settings and application files should be stored in the user's home directory.

Process​

public abstract IProcessImpl Process { get; }

Provides an abstraction for dealing with the dotnet Process API. This is used to start processes and get information about the current process.

ThisExeRelativePath​

public virtual string? ThisExeRelativePath { get; }

The path from AppContentDir to this executable.

CurrentlyInstalledVersion​

public abstract SemanticVersion? CurrentlyInstalledVersion { get; }

The currently installed version of the application, or null if the app is not installed.

Methods​

MethodSummary
CreateDefaultForPlatformCreate a new default locator based on the current operating system.
AddLoggerAdd a logger to the list of loggers. This will be used to log messages from Velopack.
GetLocalPackagesFinds .nupkg files in the PackagesDir and returns a list of ReleaseEntryName objects.
GetLatestLocalFullPackageFinds latest .nupkg file in the PackagesDir or null if not found.
CreateSubDirIfDoesNotExistGiven a base dir and a directory name, will create a new sub directory of that name.
GetOrCreateStagedUserIdUnique identifier for this user which is used to calculate whether this user is eligible for

CreateDefaultForPlatform(processImpl, logger)​

public static IVelopackLocator CreateDefaultForPlatform(IProcessImpl? processImpl = null, IVelopackLogger? logger = null)

Create a new default locator based on the current operating system.

Parameters

NameTypeDescription
processImplIProcessImpl
loggerIVelopackLogger

Returns IVelopackLocator

AddLogger(logger)​

public void AddLogger(IVelopackLogger logger)

Add a logger to the list of loggers. This will be used to log messages from Velopack.

Parameters

NameTypeDescription
loggerIVelopackLogger

GetLocalPackages()​

public virtual List<VelopackAsset> GetLocalPackages()

Finds .nupkg files in the PackagesDir and returns a list of ReleaseEntryName objects.

Returns List<VelopackAsset>

GetLatestLocalFullPackage()​

public virtual VelopackAsset? GetLatestLocalFullPackage()

Finds latest .nupkg file in the PackagesDir or null if not found.

Returns VelopackAsset

CreateSubDirIfDoesNotExist(baseDir, newDir)​

protected static string? CreateSubDirIfDoesNotExist(string? baseDir, string? newDir)

Given a base dir and a directory name, will create a new sub directory of that name. Will return null if baseDir is null, or if baseDir does not exist.

Parameters

NameTypeDescription
baseDirstring
newDirstring

Returns string

GetOrCreateStagedUserId()​

public Guid? GetOrCreateStagedUserId()

Unique identifier for this user which is used to calculate whether this user is eligible for staged roll outs.

Returns Guid?

Fields​

FieldSummary
DefaultLoggingFileNameThe default log file name for Velopack.

DefaultLoggingFileName​

protected const string DefaultLoggingFileName = "velopack.log"

The default log file name for Velopack.


Generated from Velopack 1.2.0