Troubleshooting

Fix Bevel build errors, export failures, broken links under a sub-path, and missing or stale pages.

On this page
bash
dotnet build -c Release 2>&1 | grep -E "error|warning"

Most problems show up as file(line,col): error BEVEL0xx in the build. Bevel lists every data problem in one run, and each message ends with a Help: link. Look the code up in Diagnostics. This page covers the problems that have no code.

The build

I get CS0234: namespace 'Pages' does not exist

SDK 11.0.100's Razor generator has a bug. When you build through a symlinked project path, it drops the folder from component namespaces, so Pages/Home.razor becomes MyApp.Home.

Build from the real path with cd -P ., or use SDK 10.

My ISiteData is missing or has no Posts

Check these, in order.

  1. Your files are under Data/. Bevel only runs when a Data folder or bevel.json exists.
  2. Your record has [DataSource("Posts", "./**/*.md")]. The dataset name is the property name.
  3. MSBuild.BevelPrebuildEnabled is not false.
  4. The data step finished. Read the build output for BEVEL errors above the first C# error.

My edit to a file did not change the output

The data step skips itself when no input changed. It tracks everything under Data/, files a data source read, appsettings*.json and bevel.json. If a loader reads a database, an API or a file it did not register, set MSBuild.BevelPrebuildAlwaysRun to true. dotnet build --no-incremental also forces a run.

My processor or grouper is not found

The build-time tool compiles only Data/**/*.cs. A processor, grouper or loader declared elsewhere fails with BEVEL074. Move it under Data/.

A type that uses the generated ISiteData cannot live there either, because the data step has not made it yet. Put those classes outside Data/.

A service is missing in a processor

A processor is built from the build-time service container, not your app's. Register the service in an IBevelDataStartup class. The errors are BEVEL043, BEVEL044 and BEVEL086.

The export

The export refuses to run

Bevel stops before it writes anything when it finds a route that needs authorization: static files cannot enforce it. Mark the route .ExcludeFromStaticExport() to serve it live only, or .AllowStaticExport() if you really want it public.

It also refuses an unsafe output folder: a filesystem root, your home folder, your project folder, a symbolic link, or any folder with a .csproj, .sln or .git entry. Use a folder such as dist or the default wwwroot.

I get "No page '/posts/nope' exists"

A link points at a route no MapStatic creates. Fix the value you pass to Links.To, or add the mapping. Bevel lists the known routes in the message.

I get "no mapping renders the type" or "two mappings render the type"

Links.To<TPage>(item) needs exactly one mapping for a page type. Add the MapStatic, or use Links.To<TPage>(item) when two mappings render the same page.

Drafts showed up in my export

You exported from a Debug build. Debug builds run build-time code as Development, so a processor that keeps drafts there keeps them. Bevel logs a warning when it exports data built for Development. Export with -c Release, or set ASPNETCORE_ENVIRONMENT=Production.

Two pages write to one file

Bevel checks every output path before the first page renders. A duplicate path, an asset folder that collides with a page, or a wwwroot file with the same path as a route fails the export. Rename one of them.

An export step failed

A step you added with AfterExport or AddBevelExportStep threw. The files are already written. Bevel wraps the error and names the step, and --bevel-build exits with code 1. Fix the step, then export again.

You host at https://you.github.io/repo/ but links point at /. Set options.PathBase = "/repo" and build links with Links.To(...) and Links.Asset(...). For HTML you cannot change, such as Markdown rendered to a MarkupString, set options.RewriteHtmlLinks = true. See BevelOptions.PathBase and BevelOptions.RewriteHtmlLinks.

A relative image in a post is broken

Bevel pages have no trailing slash (/posts/my-post), so how-it-works.svg resolves to /posts/how-it-works.svg. Prefix relative image URLs with Links.Asset("/posts/my-post/"). The sample blog's Markdown component does this with an AssetBase parameter. See Build a blog.

My page renders live, with a warning, in production

Bevel serves an exported file only when .bevel-output.json lists it and its SHA-256 still matches. If you changed a file by hand, copied files over the export, or the manifest is missing, the page renders live and Bevel logs a warning once for that route. Re-export instead of editing files.

Still stuck?

Turn on LogStats to see what Bevel built, then open an issue with the output. See What Bevel processed.