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.
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.
// Install DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator as a Cake Addin
#addin nuget:?package=DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator&version=1.0.0-alpha.5&prerelease

// Install DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator as a Cake Tool
#tool nuget:?package=DionTools.AspNetCoreEmbeddedStaticFilesSourceGenerator&version=1.0.0-alpha.5&prerelease

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 152 12/8/2023
1.0.0-alpha.4 59 12/8/2023
1.0.0-alpha.3 58 12/8/2023
1.0.0-alpha.2 53 12/8/2023
1.0.0-alpha 75 12/8/2023