Skip to content

Build Configuration

Build and publish related options are configured in .csproj file via MSBuild properties.

PropertyDefaultDescription
BootsharpNamebootsharpName of the generated JavaScript module.
BootsharpEmbedBinariestrueWhether to embed binaries to the JavaScript module file.
BootsharpAggressiveTrimmingfalseWhether to disable some .NET features to reduce binary size.
BootsharpBundleCommandnpx rollupThe command to bundle generated JavaScrip solution.
BootsharpPublishDirectory/binDirectory to publish generated JavaScript module.
BootsharpTypesDirectory/typesDirectory to publish type declarations.
BootsharpBinariesDirectory/binDirectory to publish binaries when EmbedBinaries disabled.
BootsharpPackageDirectory/Directory to publish package.json file.

Below is an example configuration, which will make Bootsharp name compiled module "backend" (instead of the default "bootsharp"), publish the module under solution directory root (instead of "/bin"), disable binaries embedding and instead publish them under "public/bin" directory one level above the solution root and enable aggressive assembly trimming to reduce build size:

xml
<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <RuntimeIdentifier>browser-wasm</RuntimeIdentifier>
        <BootsharpName>backend</BootsharpName>
        <BootsharpPackageDirectory>$(SolutionDir)</BootsharpPackageDirectory>
        <BootsharpEmbedBinaries>false</BootsharpEmbedBinaries>
        <BootsharpBinariesDirectory>$(SolutionDir)../public/bin</BootsharpBinariesDirectory>
        <BootsharpAggressiveTrimming>true</BootsharpAggressiveTrimming>
    </PropertyGroup>

    <ItemGroup>
        <PackageReference Include="Bootsharp" Version="*-*"/>
    </ItemGroup>

</Project>