GaEpd.FileService 3.4.0

Prefix Reserved
dotnet add package GaEpd.FileService --version 3.4.0
                    
NuGet\Install-Package GaEpd.FileService -Version 3.4.0
                    
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="GaEpd.FileService" Version="3.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GaEpd.FileService" Version="3.4.0" />
                    
Directory.Packages.props
<PackageReference Include="GaEpd.FileService" />
                    
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 GaEpd.FileService --version 3.4.0
                    
#r "nuget: GaEpd.FileService, 3.4.0"
                    
#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 GaEpd.FileService@3.4.0
                    
#: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=GaEpd.FileService&version=3.4.0
                    
Install as a Cake Addin
#tool nuget:?package=GaEpd.FileService&version=3.4.0
                    
Install as a Cake Tool

Georgia EPD-IT File Service Library

This library was created by Georgia EPD-IT to provide common file services for our web applications.

Georgia EPD-IT .NET Test SonarCloud Quality Gate Status Lines of Code

Installation

Nuget

To install, search for "GaEpd.FileService" in the NuGet package manager or run the following command:

dotnet add package GaEpd.FileService

Interface

An IFileService interface is used to abstract out common file persistence operations:

  • SaveFileAsync
  • FileExistsAsync
  • ListFilesAsync
  • GetFileAsync
  • TryGetFileAsync
  • DeleteFileAsync

Implementations

The library includes three useful File Service implementations that store files in memory, the file system, or Azure Blob Storage. A description of each implementation and its parameters is below.

Registration

The simplest way to register one of the implementations is to use the AddFileServices() extension method and configure the desired implementation in the app configuration. Add the following line to your Program file:

builder.AddFileServices();

And add the following section to your appsettings.json configuration file:

{
  "FileServiceSettings": {
    "FileService": "",
    "FileSystemBasePath": "",
    "NetworkUsername": "",
    "NetworkDomain": "",
    "NetworkPassword": "",
    "AzureAccountName": "",
    "AzureTenantId": "",
    "BlobContainer": "",
    "BlobBasePath": ""
  }
}

The FileService setting must be included and must be set to either InMemory, FileSystem, or AzureBlobStorage. Other settings only need to be included if required by the selected implementation.

  • If InMemory is chosen, all other settings are ignored and can be left out.

  • If FileSystem is chosen, then FileSystemBasePath is required. NetworkUsername, NetworkDomain, and NetworkPassword can be provided if needed. Other settings are ignored.

  • If AzureBlobStorage is chosen, then AzureAccountName and BlobContainer are required. BlobBasePath and AzureTenantId can be provided if needed. Other settings are ignored.

Alternatively, you can directly register one of the implementations as shown in the sections below.

In Memory

The in-memory implementation stores files in memory. All data will be lost when the app restarts (only useful for development).

builder.Services.AddSingleton<IFileService, InMemory>();

File System

The file system implementation writes files to a local or network drive. The basePath parameter is required and defines where the files will be stored. If basePath doesn't exist in the file system, it will be created.

builder.Services.AddTransient<IFileService, FileSystem>(_ => new FileSystem(basePath));

If a Windows Identity is required to access the desired file location, use the overload that accepts username, domain, and password parameters in the constructor.

builder.Services.AddTransient<IFileService, FileSystem>(_ => new FileSystem(basePath, username, domain, password));

Azure Blob Storage

The Azure Blob Storage service requires an Azure account and an existing Blob Storage container. (The service does not attempt to create the container if it does not exist.) The basePath parameter is optional and is prepended to file names as a path segment.

The tenantId parameter is also optional and specifies the ID of the tenant to which the credential will authenticate by default. (This is useful in multi-tenant situations where the desired Tenant ID is not the default.)

builder.Services.AddSingleton<IFileService, AzureBlobStorage>(_ => new AzureBlobStorage(accountName, container, basePath, tenantId));
Azure Blob Storage Authentication

This library uses the DefaultAzureCredential class to authenticate with Azure Blob Storage. Review the documentation on using developer accounts during local development.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.4.0 32 7/30/2026
3.3.3 158 7/21/2026
3.3.2 324 4/15/2026
3.3.1 294 1/12/2026
3.3.0 167 1/7/2026
3.2.1 416 10/22/2025
3.2.1-beta.1 171 10/20/2025
3.2.0 1,656 1/28/2025
3.1.1 2,948 3/5/2024
3.1.0 639 1/25/2024
3.0.0 276 1/24/2024
2.1.0 311 1/16/2024
2.0.0 294 1/2/2024
1.0.0 400 10/25/2023

# Changelog
## [3.4.0] - 2026-07-30
- Renamed `GetFilesAsync` to `ListFilesAsync`. (`GetFilesAsync` is still available as an alias, but it's marked
"Obsolete" and will be removed in a future version.)
- Marked the `services.AddFileServices(configuration)` overload as "Obsolete". Use `builder.AddFileServices()` instead.
## [3.3.3] - 2026-07-21
- Updated NuGet packages.
## [3.3.2] - 2026-04-15
- Updated NuGet packages.
## [3.3.1] - 2026-01-12
- Enabled setting the Tenant ID when using Azure Blob Storage.
## [3.3.0] - 2026-01-06
- Added support for .NET 10.
## [3.2.1] - 2025-10-22
- Added a new simpler extension method for registering the file service: `builder.AddFileServices()`.
## [3.2.0] - 2025-01-23
- Target .NET 8 and 9.
## [3.1.1] - 2024-03-05
### Fixed
- Updated `GetFilesAsync` in the `FileSystem` implementation so that it doesn't throw an exception if the path doesn't
exist, making it consistent with the other implementations.
## [3.1.0] - 2024-01-25
### Changed
- Added `ConfigureAwait(false)` call to awaited tasks.
## [3.0.0] - 2024-01-25
### Added
- Added a method to list files in a specified path.
### Changed
- **Breaking change** This release changes how paths are built when using Azure Blob Storage in order to avoid platform
inconsistencies. It's possible this could result in `FileExistsAsync` and `GetFilesAsync` failing for existing files.
Thorough testing is recommended when updating.
## [2.1.0] - 2024-01-16
### Added
- Added an extension method for registering and configuring file services.
## [2.0.0] - 2024-01-02
- Upgraded to .NET 8.0.
## [1.0.0] - 2023-10-25
_Initial release._
[1.0.0]: https://github.com/gaepdit/app-library/releases/tag/fs%2Fv1.0.0
[2.0.0]: https://github.com/gaepdit/app-library/releases/tag/fs%2Fv2.0.0
[2.1.0]: https://github.com/gaepdit/app-library/releases/tag/f%2Fv2.1.0
[3.0.0]: https://github.com/gaepdit/file-service/releases/tag/v3.0.0
[3.1.0]: https://github.com/gaepdit/file-service/releases/tag/v3.1.0
[3.1.1]: https://github.com/gaepdit/file-service/releases/tag/v3.1.1
[3.2.0]: https://github.com/gaepdit/file-service/releases/tag/v3.2.0
[3.2.1]: https://github.com/gaepdit/file-service/releases/tag/v3.2.1
[3.3.0]: https://github.com/gaepdit/file-service/releases/tag/v3.3.0
[3.3.1]: https://github.com/gaepdit/file-service/releases/tag/v3.3.1
[3.3.2]: https://github.com/gaepdit/file-service/releases/tag/v3.3.2
[3.3.3]: https://github.com/gaepdit/file-service/releases/tag/v3.3.3
[3.4.0]: https://github.com/gaepdit/file-service/releases/tag/v3.4.0