_Create.cshtml (snippet)
@model MC.Models.AdminViewModels.NewUserViewModel
@await Html.PartialAsync("_ModalHeader", new ModalHeader() { Title= "New User"})
<div class="modal-body">
<form asp-action="Create">
<div class="form-horizontal">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="NewUser.FirstName" class="col-md-4 control-label">First Name</label>
<div class="col-md-8">
<input asp-for="NewUser.FirstName" class="form-control" />
<span asp-validation-for="NewUser.FirstName" class="text-danger"></span>
</div>
</div>
Microsoft.AspNetCore.Mvc.Razor.Compilation.CompilationFailedException: One or more compilation failures occurred: C:\Projects\Webs\MC\Areas\Admin\Views\Shared_ModalFooter.cshtml(1,3): Error RZ9999: The 'model` directive must appear at the start of the line. at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CompileAndEmit(String relativePath) at Microsoft.AspNetCore.Mvc.Razor.Internal.RazorViewCompiler.CreateCacheEntry(String normalizedPath)
_ModalFooter.cshtml (example of nearly exactly what is in _ModalHeader)
@model MC.Models.ModalFooter
<div class="modal-footer">
<button data-dismiss="modal" id="@Model.CancelButtonID" class="btn btn-default" type="button">@Model.CancelButtonText</button>
@if (!Model.OnlyCancelButton)
{
<button class="btn btn-success" id="@Model.SubmitButtonID" type="submit">
@Model.SubmitButtonText
</button>
}
</div>
This has thrown me for a loop. Asp.net Core 2.0, works just fine in 1.1.2 but this is thrown for each and ever partial within partial, that is setup for modal use. Error RZ9999 hasn't been documented anywhere apparently. Of course taking out the the partial for straight html doesn't throw the error, but as can imagine that is 1 line verse 3-4 lines of code. I figure I am missing something from Asp.net Core MVC 1.1 to 2.0 conversion somewhere. Also this is partial within a partial.
NOTE: I am using the 'Microsoft.AspNetCore.All' package pull in the *.csproj, since release day NuGet didn't have the EF tools packages for v2.