Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force Razor syntax literals

I had this in a .cshtml view:

    <script src="/Scripts/app/[email protected]()"></script>

Razor renders this to the view:

    <script src="/Scripts/app/app.min.js?41231112"></script>

When I change the .cshtml view to this:

    <script src="/Scripts/app/[email protected]()"></script>

Then I get this in the rendered view:

    <script src="/Scripts/app/[email protected]()"></script>

How do I get @Html.BuildTag() to render 41231112 when there's no leading ? character?

like image 354
core Avatar asked Mar 16 '23 00:03

core


1 Answers

Make it an explicit code block by wrapping it in ().

<script src="/Scripts/app/app.min.js@(Html.BuildTag())"></script>
like image 121
Brandon Avatar answered Mar 26 '23 01:03

Brandon