StockSharp.Configuration 5.0.232

Prefix Reserved
dotnet add package StockSharp.Configuration --version 5.0.232
                    
NuGet\Install-Package StockSharp.Configuration -Version 5.0.232
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StockSharp.Configuration" Version="5.0.232" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StockSharp.Configuration" Version="5.0.232" />
                    
Directory.Packages.props
<PackageReference Include="StockSharp.Configuration" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add StockSharp.Configuration --version 5.0.232
                    
#r "nuget: StockSharp.Configuration, 5.0.232"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package StockSharp.Configuration@5.0.232
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=StockSharp.Configuration&version=5.0.232
                    
Install as a Cake Addin
#tool nuget:?package=StockSharp.Configuration&version=5.0.232
                    
Install as a Cake Tool

StockSharp.Configuration

StockSharp.Configuration is a .NET Standard library that centralizes various configuration facilities used by the StockSharp trading platform. It provides classes for storing application paths, loading settings, managing user credentials, and constructing message adapters. The assembly is titled S#.Configuration and described as "Configuration components."

Features

  • System paths – the Paths class defines all important directories and files used by StockSharp. Paths are initialized from PathsHolder and configuration files, as shown below:
    var companyPath = PathsHolder.CompanyPath ?? ConfigManager.TryGet<string>("companyPath");
    CompanyPath = companyPath.IsEmpty() ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "StockSharp") : companyPath.ToFullPathIfNeed();
    CredentialsFile = Path.Combine(CompanyPath, $"credentials{DefaultSettingsExt}");
    PlatformConfigurationFile = Path.Combine(AppDataPath, $"platform_config{DefaultSettingsExt}");
    
    【F:Configuration/Paths.cs†L14-L26】
  • Start‑up settings – AppStartSettings stores language preference and online/offline mode and can be loaded or saved from the platform configuration file:
    public class AppStartSettings : IAsyncPersistable
    {
        public string Language { get; set; } = LocalizedStrings.ActiveLanguage;
        public bool Online { get; set; } = true;
        public static async ValueTask<AppStartSettings> TryLoadAsync(IFileSystem fileSystem, CancellationToken cancellationToken)
        {
            var configFile = Paths.PlatformConfigurationFile;
            if (configFile.IsEmptyOrWhiteSpace() || !configFile.IsConfigExists(fileSystem))
                return null;
            var storage = await configFile.DeserializeAsync<SettingsStorage>(fileSystem, cancellationToken);
            return storage is null ? null : await storage.LoadAsync<AppStartSettings>(cancellationToken);
        }
    }
    
    【F:Configuration/AppStartSettings.cs†L4-L41】
  • Credentials management – the ICredentialsProvider interface allows loading, saving and deleting of ServerCredentials. The default implementation persists credentials in Paths.CredentialsFile:
    public interface ICredentialsProvider
    {
        bool TryLoad(out ServerCredentials credentials);
        void Save(ServerCredentials credentials, bool keepSecret);
        void Delete();
    }
    
    【F:Configuration/ICredentialsProvider.cs†L4-L25】
    class DefaultCredentialsProvider : ICredentialsProvider
    {
    
  • private readonly Lock _lock = new();
    private ServerCredentials _credentials;
    bool ICredentialsProvider.TryLoad(out ServerCredentials credentials)
    {
        using (_lock.EnterScope())
        {
            if(_credentials != null)
            {
                credentials = _credentials.Clone();
                return credentials.CanAutoLogin();
            }
            var file = Paths.CredentialsFile;
            credentials = null;
            if (file.IsConfigExists())
            {
                credentials = new ServerCredentials();
                credentials.LoadIfNotNull(file.Deserialize<SettingsStorage>());
                _credentials = credentials.Clone();
            }
            return credentials?.CanAutoLogin() == true;
        }
    }
    
    }
    【F:Configuration/DefaultCredentialsProvider.cs†L3-L38】
    
  • Invariant serialization – InvariantCultureSerializer saves configuration files using the invariant culture and UTF‑8 encoding, enabling culture‑independent settings:
    public static class InvariantCultureSerializer
    {
        public static void SerializeInvariant(this SettingsStorage settings, string fileName, bool bom = true)
        {
            if (settings is null)
                throw new ArgumentNullException(nameof(settings));
            Do.Invariant(() => settings.Serialize(fileName, bom));
        }
    }
    
    【F:Configuration/InvariantCultureSerializer.cs†L3-L23】
  • Message adapter discovery – InMemoryMessageAdapterProvider scans all local assemblies for IMessageAdapter implementations and can create adapters on demand:
    public class InMemoryMessageAdapterProvider : IMessageAdapterProvider
    {
        public InMemoryMessageAdapterProvider(IEnumerable<IMessageAdapter> currentAdapters, Type transportAdapter = null)
        {
            CurrentAdapters = currentAdapters ?? throw new ArgumentNullException(nameof(currentAdapters));
            var idGenerator = new IncrementalIdGenerator();
            PossibleAdapters = [.. GetAdapters().Select(t =>
            {
                try
                {
                    return t.CreateAdapter(idGenerator);
                }
                catch (Exception ex)
                {
                    ex.LogError();
                    return null;
                }
            }).WhereNotNull()];
        }
    }
    
    【F:Configuration/InMemoryMessageAdapterProvider.cs†L5-L51】
  • Utility helpers – the Paths class also exposes methods for serialization, backup management and building links to StockSharp documentation and store pages.

Usage

  1. Configure global paths before accessing Paths by setting PathsHolder.CompanyPath and PathsHolder.AppDataPath if your application uses custom directories.
  2. Load or create application start settings with AppStartSettings.TryLoad and save them using TrySave.
  3. Implement ICredentialsProvider or use DefaultCredentialsProvider to persist server credentials securely.
  4. Use InvariantCultureSerializer when you need stable serialization irrespective of system locale.
  5. Create an instance of InMemoryMessageAdapterProvider to dynamically discover available message adapters.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (9)

Showing the top 5 NuGet packages that depend on StockSharp.Configuration:

Package Downloads
StockSharp.Algo

Trading algorithms. More info on web site https://stocksharp.com/store/

StockSharp.Licensing

Licensing components. More info on web site https://stocksharp.com/store/

StockSharp.Server.Core

Core server components. More info on web site https://stocksharp.com/store/

StockSharp.Alerts.Interfaces

S#.Alerts.Interfaces More info on web site https://stocksharp.com/store/

StockSharp.UdpDumper.Core

Dump UDP datagram core. More info on web site https://stocksharp.com/store/

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.232 34 10/25/2026
5.0.231 94 10/24/2026
5.0.230 560 9/13/2026
5.0.229 372 9/9/2026
5.0.228 325 8/26/2026
5.0.227 251 8/26/2026
5.0.226 329 8/20/2026
5.0.225 403 8/18/2026
5.0.224 313 8/15/2026
5.0.223 270 8/11/2026
5.0.222 300 7/30/2026
5.0.221 277 7/28/2026
5.0.220 289 3/17/2026
5.0.219 175 3/6/2026
5.0.218 7,616 9/11/2025
5.0.217 1,048 9/1/2025
5.0.216 1,980 8/30/2025
5.0.215 1,061 8/10/2025
5.0.214 1,348 7/23/2025
5.0.213 3,076 7/20/2025
Loading failed

Updated Ecng.Configuration to 1.0.282.
Updated NuGet.Configuration to 7.9.0.