Razor displays...">

Syntax literals Force Razor

I had this in a .cshtml view:

    <script src="/Scripts/app/app.min.js?@Html.BuildTag()"></script>

Razor displays this in the form:

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

When I change the .cshtml view to this:

    <script src="/Scripts/app/app.min.js@Html.BuildTag()"></script>

Then I get this in a visualized view:

    <script src="/Scripts/app/app.min.js@Html.BuildTag()"></script>

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

+4
source share
1 answer

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

<script src="/Scripts/app/app.min.js@(Html.BuildTag())"></script>
+7
source

All Articles