Sparkdo.VirtualFileSystem 1.0.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Sparkdo.VirtualFileSystem --version 1.0.1
                    
NuGet\Install-Package Sparkdo.VirtualFileSystem -Version 1.0.1
                    
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="Sparkdo.VirtualFileSystem" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sparkdo.VirtualFileSystem" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Sparkdo.VirtualFileSystem" />
                    
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 Sparkdo.VirtualFileSystem --version 1.0.1
                    
#r "nuget: Sparkdo.VirtualFileSystem, 1.0.1"
                    
#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 Sparkdo.VirtualFileSystem@1.0.1
                    
#: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=Sparkdo.VirtualFileSystem&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Sparkdo.VirtualFileSystem&version=1.0.1
                    
Install as a Cake Tool

Sparkdo.VirtualFileSystem

Sparkdo 虚拟文件系统扩展库,提供统一的文件访问接口,支持物理文件、嵌入资源和内存文件。

功能特性

  • 统一访问物理文件、嵌入资源和内存文件
  • 支持路径重写和过滤
  • 提供目录内容的抽象表示
  • 与 ASP.NET Core IFileProvider 接口兼容

配置选项

BypassEmbeddedContent

在开发过程中,您可能希望绕过嵌入资源直接从文件系统加载文件,以避免在更新资源时重新启动应用程序:

services.Configure<SparkdoVirtualFileSystemOptions>(options =>
{
    // 绕过嵌入资源,直接从文件系统加载
    options.BypassEmbeddedContent = true;
    
    // 可选:指定物理路径根目录覆盖
    options.EmbeddedContentPhysicalPathRootOverride = "/path/to/project";
});

BypassEmbeddedContent 设置为 true 时,系统会尝试从物理文件系统加载资源而不是使用嵌入资源。默认情况下,系统会使用应用程序根路径加上程序集名称作为文件夹来查找资源文件。您可以通过设置 EmbeddedContentPhysicalPathRootOverride 来覆盖默认的根路径。

VirtualFileRegistrations

通过 AddVirtualFile 扩展方法配置虚拟文件源:

services.Configure<SparkdoVirtualFileSystemOptions>(options =>
{
    // 添加嵌入资源
    options.AddVirtualFile(context =>
    {
        // 添加当前程序集中的嵌入资源,路径为 "/wwwroot"
        context.AddEmbedded<Startup>("/wwwroot");
        
        // 添加带路径重写的嵌入资源
        context.AddEmbedded<Startup>("/assets", "/public/assets");
    });
    
    // 添加物理文件
    options.AddVirtualFile(context =>
    {
        // 添加物理文件目录
        context.AddPhysical("/path/to/files");
        
        // 添加物理文件目录并指定排除过滤器
        context.AddPhysical("/path/to/other/files", ExclusionFilters.Hidden | ExclusionFilters.System);
    });
});
AddEmbedded 方法

AddEmbedded<T>(path, rewriteFrom) 方法用于添加嵌入资源:

  • T:包含嵌入资源的程序集类型
  • path:嵌入资源的路径(例如 "/wwwroot")
  • rewriteFrom:可选的路径重写,用于将虚拟路径映射到实际的嵌入资源路径
AddPhysical 方法

AddPhysical(root, exclusionFilters) 方法用于添加物理文件:

  • root:物理文件系统的根目录路径
  • exclusionFilters:排除过滤器,默认为 ExclusionFilters.Sensitive,可以指定哪些文件应该被排除
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Sparkdo.VirtualFileSystem:

Package Downloads
Sparkdo.Localization

Sparkdo 本地化模块,提供完整的本地化功能实现

Sparkdo.Timing

Sparkdo 时序处理库,提供时钟、时区处理和时间相关的功能

Sparkdo.Emailing

Sparkdo 邮件发送库,提供基于 SMTP 的邮件发送功能,支持同步/异步发送、后台队列发送和模板邮件

Sparkdo.AspNetCore

Sparkdo ASP.NET Core 集成库,提供与 ASP.NET Core 框架深度集成的功能实现

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2-preview.1 174 12/4/2025
1.0.1 2,657 11/27/2025
1.0.0 2,629 11/25/2025
1.0.0-preview.5 107 10/24/2025