© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
1 reply
Lunar Source

❔ Blazor WebAssembly change index.html to .cshtml

Hello,

I'm using .NET 7 Blazor WebAssembly Standalone (aka not ASP.Net Hosted). I am trying to figure out how to change the index.html to index.cshtml so I can use C# in the page. All articles and topics i've found are for Blazor Server and Blazor WASM hosted. In which they have access to
app.MapFallbackToFile("index.html");
app.MapFallbackToFile("index.html");


So I am trying to figure it out for not hosted Blazor WASM. The short description of why asking. Tired of dealing with Blazor caching .js and .css files causing problems with users after update having to clear cache/hard refresh etc. So I want to pull the assembly version in the page so i can do something like
@ {
     string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
}

<script src="js/CustFunctions.js?v=@version"></script>
@ {
     string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
}

<script src="js/CustFunctions.js?v=@version"></script>


So i can force the browser to recache stuff.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Blazor Webassembly
C#CC# / help
3y ago
❔ Blazor WebAssembly CSS
C#CC# / help
3y ago
Blazor WebAssembly API Controller
C#CC# / help
12mo ago
Index.cshtml not found
C#CC# / help
2y ago