Getting Started
Set up the Bootstrap Component Library (BCL) TagHelpers in an MVC app.
1) Install and reference libraries
Ensure your project references the BCL libraries (Projects or NuGet):
CopelandSyst.BootstrapComponentsCopelandSyst.BootstrapModelsCopelandSyst.StandardTagsLibrary
2) Configure Program.cs
Register MVC + BCL view locations and required services.
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddControllersWithViews()
.AddBootstrapViewLocations();
builder.Services.AddAntiforgery();
builder.Services.AddHttpContextAccessor();
// BCL + StandardTags services
builder.Services.AddScoped();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
builder.Services.AddSingleton();
#if DEBUG
builder.Services.AddTagStackCapturePolicy(o => o.EnableCapture(true));
#endif
var app = builder.Build();
// Optional CSP middleware (uses INonceService)
app.UseMiddleware();
app.UseStaticFiles();
app.UseRouting();
// Map StandardTags static resources (JS/CSS helpers)
app.MapStandardTagLibraryResources();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Docs}/{action=GettingStarted}/{id?}");
app.Run();
3) Update layout
Include Bootstrap CSS/JS and Prism (optional) and use the BCL TagHelpers.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="~/_content/CopelandSyst.BootstrapComponents/lib/Bootstrap/dist/css/bootstrap.min.css" />
<style-capture />
</head>
<body>
<div class="container">
@RenderBody()
</div>
<script src="~/_content/CopelandSyst.BootstrapComponents/lib/Bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/_content/CopelandSyst.StandardTagsLibrary/lib/logCentral/logCentral.js"></script>
<environment include="Development">
<script src="~/_content/CopelandSyst.StandardTagsLibrary/lib/daval/dist/js/daval.js"></script>
</environment>
<environment exclude="Development">
<script src="~/_content/CopelandSyst.StandardTagsLibrary/lib/daval/dist/js/daval.min.js"></script>
</environment>
<javascript-event-capture />
<style-capture />
</body>
</html>
4) Use TagHelpers
A simple dropdown using BCL:
<bs-dropdown btn-style="Secondary">
Dropdown
<bs-dropdown-menu>
<bs-dropdown-menu-item href="#">Action</bs-dropdown-menu-item>
</bs-dropdown-menu>
</bs-dropdown>
Notes
- Nonce-based CSP is supported via
INonceService. Register it as scoped so nonce values are request scoped, not application lifetime. Inline scripts/styles in views should use provided helpers. MapStandardTagLibraryResources()exposes required static assets.- In debug, Tag Stack Capture helps diagnose TagHelper misuse.