ASP.NET Core MVC Views Report model class does not have definition for new property
<p>I am working on an ASP.NET Core MVC project (v.1.0.0). It is currently published to a staging and a production environment. One of the model classes was recently updated to add two new properties. </p>

<p>In both the development and staging environments, these new properties are working fine. </p>

<p>However, when deployed to the production environment the Views that reference these new properties report that they are not defined in the class. In Production: </p>

<p>1) Entity Framework was able to successfully implement the migration and update the database schema based on the updated class.</p>

<p>2) Controllers are able to interact with these new properties and even save to the database.</p>

<p>3) However, when using a View strongly-typed for the same class an error is thrown stating that Location does not contain a definition for Latitude.</p>

<p>Again, the same Views can work fine with the new properties in Development and Staging environments.</p>

<p>Location.cs</p>

<pre><code>public class Location
{
    public int Id { get; set; }
    [Required]
    public string Name { get; set; }
    [Required]
    [Display(Name = "Address Line 1")]
    public string AddressLine1 { get; set; }
    [Display(Name = "Address Line 2")]
    public string AddressLine2 { get; set; }
    [Required]
    public string City { get; set; }
    [Required]
    public string State { get; set; }
    [Required]
    [Display(Name = "Postal Code")]
    public int PostalCode { get; set; }

    public double Latitude { get; set; }    // New
    public double Longitude { get; set; }   // New

    public string Notes { get; set; }

    public Boolean IsActive { get; set; }
    public Boolean IsDeleted { get; set; }
}
</code></pre>

<p>AddLocation.cshtml</p>

<p>I am using the controller to get the Latitude and Longitude on submit from an external API, which is why the fields are hidden and defaulted to 0 on the AddLocation View. The same error is thrown on other Views that are used to update or display the values.</p>

<pre><code>@model MyMvcApp.Models.Location

@{
    ViewData["Title"] = "Add Location";
}

    &lt;form asp-action="AddLocation"&gt;
        &lt;div class="form-horizontal"&gt;
            &lt;hr /&gt;
            &lt;div asp-validation-summary="ModelOnly" class="text-danger"&gt;&lt;/div&gt;
            &lt;input type="hidden" asp-for="Latitude" value="0" /&gt;
            &lt;input type="hidden" asp-for="Longitude" value="0" /&gt;

            &lt;div class="form-group"&gt;
                &lt;label asp-for="Name" class="col-md-2 control-label"&gt;&lt;/label&gt;
                &lt;div class="col-md-10"&gt;
                    &lt;input asp-for="Name" class="form-control" /&gt;
                    &lt;span asp-validation-for="Name" class="text-danger" /&gt;
                &lt;/div&gt;
            &lt;/div&gt;

            &lt;div class="form-group"&gt;
                &lt;label asp-for="AddressLine1" class="col-md-2 control-label"&gt;&lt;/label&gt;
                &lt;div class="col-md-10"&gt;
                    &lt;input asp-for="AddressLine1" class="form-control" /&gt;
                    &lt;span asp-validation-for="AddressLine1" class="text-danger" /&gt;
                &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="form-group"&gt;
                &lt;label asp-for="AddressLine2" class="col-md-2 control-label"&gt;&lt;/label&gt;
                &lt;div class="col-md-10"&gt;
                    &lt;input asp-for="AddressLine2" class="form-control" /&gt;
                    &lt;span asp-validation-for="AddressLine2" class="text-danger" /&gt;
                &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="form-group"&gt;
                &lt;label asp-for="City" class="col-md-2 control-label"&gt;&lt;/label&gt;
                &lt;div class="col-md-10"&gt;
                    &lt;input asp-for="City" class="form-control" /&gt;
                    &lt;span asp-validation-for="City" class="text-danger" /&gt;
                &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="form-group"&gt;
                &lt;label asp-for="State" class="col-md-2 control-label"&gt;&lt;/label&gt;
                &lt;div class="col-md-10"&gt;
                    &lt;select asp-for="State" asp-items="@ViewBag.StateList" class="form-control"&gt;&lt;/select&gt;
                    &lt;span asp-validation-for="State" class="text-danger" /&gt;
                &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="form-group"&gt;
                &lt;label asp-for="PostalCode" class="col-md-2 control-label"&gt;&lt;/label&gt;
                &lt;div class="col-md-10"&gt;
                    &lt;input asp-for="PostalCode" class="form-control" /&gt;
                    &lt;span asp-validation-for="PostalCode" class="text-danger" /&gt;
                &lt;/div&gt;
            &lt;/div&gt;

            &lt;div class="form-group"&gt;
                &lt;div class="col-md-offset-2 col-md-10"&gt;
                    &lt;div class="checkbox"&gt;
                        &lt;input asp-for="IsActive" /&gt;
                        &lt;label asp-for="IsActive"&gt;&lt;/label&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="form-group"&gt;
                &lt;label asp-for="Notes" class="col-md-2 control-label"&gt;&lt;/label&gt;
                &lt;div class="col-md-10"&gt;
                    &lt;input asp-for="Notes" class="form-control" /&gt;
                    &lt;span asp-validation-for="Notes" class="text-danger" /&gt;
                &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="form-group"&gt;
                &lt;div class="col-md-offset-2 col-md-10"&gt;
                    &lt;input type="submit" value="Add" class="btn btn-default" /&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/form&gt; 

@section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}
</code></pre>

<p>When I remove or comment out the references to the new properties the Views render fine.</p>

<p>Any ideas how I can correct this?</p>