Skip to main content

Fixed: The static asset was not found in the built time manifest in ASP.NET Core

· 8 min read
Jagdish Kumawat
Founder @ Dewiride

I added a page to an ASP.NET Core app's wwwroot folder while the app was running. The page loaded, but the app's terminal printed a warning: The static asset '/later.html' was not found in the built time manifest. A restart cleared it, and the reason is in how MapStaticAssets finds its files.

What I Was Doing​

I was building a small ASP.NET Core app on .NET 10 that serves its pages from wwwroot. Its Program.cs serves them with MapStaticAssets:

Program.cs
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

app.MapStaticAssets();
app.MapGet("/", () => "Hello World!");

app.Run();

The app was running from dotnet run, and wwwroot/hello.html was already being served. Without stopping the app, I added a second page, wwwroot/later.html:

wwwroot/later.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Later</title>
</head>
<body>
<p>Added while the app was running.</p>
</body>
</html>

Then I asked for it from a second terminal:

Terminal
curl -i http://localhost:5088/later.html

What I Expected​

The page, served like hello.html, and nothing new in the app's terminal.

What I Got​

The page came back:

Output
HTTP/1.1 200 OK
Content-Length: 161
Content-Type: text/html
Date: Thu, 03 Dec 2026 08:54:38 GMT
Server: Kestrel
Accept-Ranges: bytes
ETag: "ljbgRDft98QsR4/AS4By3eQNJdvJeQ3mxfQwM+WNIrg="
Last-Modified: Thu, 03 Dec 2026 08:54:36 GMT

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Later</title>
</head>
<body>
<p>Added while the app was running.</p>
</body>
</html>

But the app's terminal had a warning at the end:

A zsh terminal running dotnet run for StaticFilesDemo, listening on http://localhost:5088, ending with warn: Microsoft.AspNetCore.Builder.StaticAssetDevelopmentRuntimeHandler[1] The static asset '/later.html' was not found in the built time manifest, followed by the rest of the message.

Output
warn: Microsoft.AspNetCore.Builder.StaticAssetDevelopmentRuntimeHandler[1]
The static asset '/later.html' was not found in the built time manifest. This file will not be available at runtime if it is not available at compile time during the publish process. If the file was not added to the project during development, and is created at runtime, use the StaticFiles middleware to serve it instead.

The response was also missing two headers that hello.html had: Cache-Control: no-cache and Vary: Accept-Encoding.

What I Checked​

That the file was in the right place. It was: the app served it, from wwwroot/later.html.

What the warning says. It names a built time manifest and says the file will not be available at runtime if it is not available at compile time during the publish process. So the warning is about a list made when the project is built, and later.html didn't exist yet when my running app was built.

What Microsoft's documentation says about that list. The static files guide explains it: MapStaticAssets serves assets from a static assets manifest rather than by scanning the web root at runtime. The manifest is generated at build and publish time and records the static web assets discovered for the app, along with metadata such as content fingerprints, Content-Type headers, caching headers. And: Because MapStaticAssets only serves assets listed in the manifest, it doesn't serve files that aren't part of the manifest.

Where the manifest is. The guide says the build writes it to the build output as {ASSEMBLY NAME}.staticwebassets.endpoints.json. For this app, that's bin/Debug/net10.0/StaticFilesDemo.staticwebassets.endpoints.json.

Why It Happens​

MapStaticAssets doesn't look in wwwroot while the app runs. It serves the files on a list, the manifest, that the build wrote, with headers worked out at build time. A file added after the build isn't on the list.

In Development, ASP.NET Core still hands such a file out, through the development handler named in the warning, so you can keep working. It warns you because a published app is built once and serves only its list: a file that only appears later wouldn't be served there. That's also why the response lacked the caching headers: they come from the manifest, and this file wasn't in it.

The Fix​

The file is part of the app, so it only needs a build that sees it. Stop the app with Ctrl+C and start it again:

Terminal
dotnet run

dotnet run builds the project before it starts the app, and that build writes a new manifest that includes later.html. You can check it: this lists the addresses in the manifest.

Terminal
grep -o '"Route":"[^"]*"' bin/Debug/net10.0/StaticFilesDemo.staticwebassets.endpoints.json | sort -u
Output
"Route":"hello.ccuu81uf36.html"
"Route":"hello.ccuu81uf36.html.gz"
"Route":"hello.html"
"Route":"hello.html.gz"
"Route":"later.html"
"Route":"later.html.gz"
"Route":"later.i9kk346zx3.html"
"Route":"later.i9kk346zx3.html.gz"

later.html is on the list now, with a compressed .gz copy and a fingerprinted address, later.i9kk346zx3.html, that the build made for it as it did for hello.html.

If a file is created by the app itself while it runs, such as an upload or a generated report, no build will ever see it. That's the case the warning's last sentence is about, and the guide's answer is the static file middleware: To serve files that aren't in the manifest, call UseStaticFiles, which serves files directly from the web root at runtime. My page wasn't that kind of file, so the restart was the whole fix.

After the Fix​

After the restart, the app's terminal stayed clean when I asked for the page:

The same zsh terminal after a fresh dotnet run: the app starts and listens on http://localhost:5088, and no warning follows.

And the response now had the same headers as hello.html:

Output
HTTP/1.1 200 OK
Content-Length: 161
Content-Type: text/html
Date: Thu, 03 Dec 2026 08:54:42 GMT
Server: Kestrel
Accept-Ranges: bytes
Cache-Control: no-cache
ETag: "ljbgRDft98QsR4/AS4By3eQNJdvJeQ3mxfQwM+WNIrg="
Last-Modified: Thu, 03 Dec 2026 08:54:36 GMT
Vary: Accept-Encoding

The ETag is the same as before, because the file's content didn't change. Only the way it was served did.

Common Mistakes​

MistakeWhat happensDo this instead
Keeping the app running after adding a page, and ignoring the warningThe page is served without the manifest's caching headersRestart, so the build lists it
Writing app-created files, such as uploads, into wwwroot and expecting MapStaticAssets to serve themThey're never in the manifest; the warning says such a file will not be available at runtime once the app is publishedServe them with UseStaticFiles, as the guide says

Troubleshooting​

SymptomLikely causeFix
The warning names a file you just addedThe running app was built before the file existedStop the app and run dotnet run again
The warning comes back after a restartThe file is created while the app runsServe it with UseStaticFiles
The file isn't in staticwebassets.endpoints.json after a buildIt isn't under wwwroot, or its extension isn't one the build treats as a static assetMove it into wwwroot

FAQ​

Will the file be served after I publish?​

Yes, if it's in wwwroot when you publish: publishing builds the app and writes the manifest again. The warning is about files that appear only after that.

Why didn't the page get Cache-Control: no-cache before the restart?​

That header comes from the manifest, which had no entry for the page. The development handler served the file itself, so the response had ETag and Last-Modified but not the manifest's headers.

Conclusion​

The static asset was not found in the built time manifest means MapStaticAssets was asked for a file that wasn't in wwwroot when the app was built. In Development, it serves the file anyway and warns you. For a file that belongs to the app, stop the app and run dotnet run again, so the build lists it. For files the app creates while it runs, use UseStaticFiles.

Additional Resources​