Mister Epic Mister Epic - 1 month ago 23
ASP.NET (C#) Question

Environment tag helper

I'm working with Visual Studio 15 RC, and I noticed in the _Layout.cshtml, there is a new

environment
tag helper:

<environment names="Development">
<link rel="stylesheet" href="~/css/bootstrap.css" />
</environment>
<environment names="Staging,Production">
<link rel="stylesheet" href="//ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/css/bootstrap.min.css"
asp-fallback-test-class="hidden" asp-fallback-test-property="visibility" asp-fallback-test-value="hidden" />
</environment>


How would I indicate that that I want a
Staging
build to get the CSS files from the CDN?

Answer Source

If you want to specify Staging environment for your build :

  • Open your project properties
  • Select the Debug tab
  • In the Environment variables section, if a variable named ASPNET_ENV doesn't exist then add it by clicking to the add button. After that set the value of the variable to Staging by double-clicking in the cell.

enter image description here