TagHelpers and inline C# - when to use what?

In regards to ASP.NET MVC Core app. I’ve noticed that current .NET tutorials indicate using tag helpers for environment dev/prod sections and etc. What is the Service Stack recommended way? SS uses inline @if (DebugMode).

Is Service Stack separating from ASP.NET in that way? Also ASP.NET uses IHostingEnvironment env and ServiceStack seems to use AppSettings.Get(nameof(HostConfig.DebugMode), false). When is it appropriate to use what?


<environment include="Development">
        <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
        <link rel="stylesheet" href="~/css/site.css" />
    <environment exclude="Development">
        <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
              asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
        <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />

Service Stack Razor (.NET Core):

@if (DebugMode) {

ServiceStack uses DebugMode (for all its AppHost’s) whilst ASP.NET uses Environment (for ASP.NET Core) which by default is Development during Development but can be configured independently.

Use Environment for ASP.NET features like custom tags,
DebugMode for any ServiceStack features.