DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator 1.0.0-alpha.5

This is a prerelease version of DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator.
dotnet add package DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator --version 1.0.0-alpha.5
                    
NuGet\Install-Package DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator -Version 1.0.0-alpha.5
                    
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="DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator" Version="1.0.0-alpha.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator" Version="1.0.0-alpha.5" />
                    
Directory.Packages.props
<PackageReference Include="DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator" />
                    
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 DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator --version 1.0.0-alpha.5
                    
#r "nuget: DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator, 1.0.0-alpha.5"
                    
#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 DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator@1.0.0-alpha.5
                    
#: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=DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator&version=1.0.0-alpha.5&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator&version=1.0.0-alpha.5&prerelease
                    
Install as a Cake Tool

AspNetCoreEmbeddedStaticFilesSourceGenerator

Supported Frameworks

  • ASP.NET Core 8

Install

dotnet add package DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator

.csproj

<ItemGroup>
  <AdditionalFiles Include="wwwroot/**" />
</ItemGroup>

Program.cs

using DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator;
using System.Net.Mime;
using Microsoft.AspNetCore.Http.HttpResults;

var builder = WebApplication.CreateSlimBuilder(args);
var app = builder.Build();

app.MapStaticFiles();
app.MapFallback(FileContentHttpResult () => EmbeddedWwwrootExtensions.Files.index_html);

app.Run();

[EmbeddedStaticFiles("./wwwroot")]
static partial class EmbeddedWwwrootExtensions
{
    private static string GetMimeTypeName(string fileName) => Path.GetExtension(fileName.AsSpan()) switch
    {
        ".html" => MediaTypeNames.Text.Html,
        ".css" => MediaTypeNames.Text.Css,
        ".js" => MediaTypeNames.Text.JavaScript,
        _ => MediaTypeNames.Application.Octet,
    };
}

Options

[EmbeddedStaticFiles("./wwwroot", MethodName = "MapWwwRootFiles")]
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

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
1.0.0-alpha.5 180 12/8/2023
1.0.0-alpha.4 87 12/8/2023
1.0.0-alpha.3 85 12/8/2023
1.0.0-alpha.2 78 12/8/2023
1.0.0-alpha 105 12/8/2023