Microsoft.Extensions.FileProviders.Physical (10.0.11)

Published 2026-09-09 02:38:03 +03:30 by kayer

Installation

dotnet nuget add source --name kayer --username your_username --password your_token 
dotnet add package --source kayer --version 10.0.11 Microsoft.Extensions.FileProviders.Physical

About this package

File provider for physical files for Microsoft.Extensions.FileProviders.

About

Provides an implementation of a physical file provider, facilitating file access and monitoring on the disk. The primary type, PhysicalFileProvider, enables the lookup of files on disk and can watch for changes either via FileSystemWatcher or polling mechanisms.

Key Features

  • Easy access and monitoring of files on the disk.
  • Ability to watch for file changes either by using FileSystemWatcher or through polling.

How to Use

This library can be used to look up files on disk and monitor file changes effectively. Below is an example of how to use the PhysicalFileProvider to access files on disk and monitor changes:

using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.FileProviders.Physical;

using var provider = new PhysicalFileProvider(AppContext.BaseDirectory);

Environment.SetEnvironmentVariable("DOTNET_USE_POLLING_FILE_WATCHER", "1");

var contents = provider.GetDirectoryContents(string.Empty);
foreach (PhysicalFileInfo fileInfo in contents)
{
    Console.WriteLine(fileInfo.PhysicalPath);
}

var changeToken = provider.Watch("*.txt");
changeToken.RegisterChangeCallback(_ => Console.WriteLine("Text file changed"), null);

Console.ReadLine();

Main Types

The main types provided by this library are:

  • Microsoft.Extensions.FileProviders.PhysicalFileProvider
  • Microsoft.Extensions.FileProviders.PhysicalDirectoryInfo
  • Microsoft.Extensions.FileProviders.PhysicalFileInfo

Additional Documentation

Feedback & Contributing

Microsoft.Extensions.FileProviders.Physical is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Dependencies

ID Version Target Framework
Microsoft.Extensions.FileProviders.Abstractions 10.0.11 .NETFramework4.6.2
Microsoft.Extensions.FileSystemGlobbing 10.0.11 .NETFramework4.6.2
Microsoft.Extensions.Primitives 10.0.11 .NETFramework4.6.2
Microsoft.Extensions.FileProviders.Abstractions 10.0.11 .NETStandard2.0
Microsoft.Extensions.FileSystemGlobbing 10.0.11 .NETStandard2.0
Microsoft.Extensions.Primitives 10.0.11 .NETStandard2.0
Microsoft.Extensions.FileProviders.Abstractions 10.0.11 net10.0
Microsoft.Extensions.FileSystemGlobbing 10.0.11 net10.0
Microsoft.Extensions.Primitives 10.0.11 net10.0
Microsoft.Extensions.FileProviders.Abstractions 10.0.11 net8.0
Microsoft.Extensions.FileSystemGlobbing 10.0.11 net8.0
Microsoft.Extensions.Primitives 10.0.11 net8.0
Microsoft.Extensions.FileProviders.Abstractions 10.0.11 net9.0
Microsoft.Extensions.FileSystemGlobbing 10.0.11 net9.0
Microsoft.Extensions.Primitives 10.0.11 net9.0
Details
NuGet
2026-09-09 02:38:03 +03:30
7
Microsoft
193 KiB
Assets (2)
Versions (3) View all
10.0.11 2026-09-09
9.0.10 2026-02-20
9.0.0 2026-02-20