Lunar Source
Lunar Source
CC#
Created by Lunar Source on 7/24/2023 in #help
❔ 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.
2 replies