When scaffolding a new MVC controller with views using Entity Framework, the Create and Edit views reference _ValidationScriptsPartial.cshtml, which is only included in the Individual Auth template, causing this error in other templates:
InvalidOperationException: The partial view '_ValidationScriptsPartial' was not found. The following locations were searched:
/Views/Movies/_ValidationScriptsPartial.cshtml
/Views/Shared/_ValidationScriptsPartial.cshtml
Everything seems to work after copying the file from another project.
TFS Bug#233433
This appears to be controlled by the "Reference script libraries" checkbox on the Add Controller dialog. It's interesting that it won't generate the file if it's missing.
For anyone that lands here in the mean time... I scaffolded a blank asp.net core project and found that the file should look like:
Add a file _ValidationScriptsPartial.cshtml to Views/Shared folder with the following:
<environment names="Development">
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
</environment>
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.15.0/jquery.validate.min.js"
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
asp-fallback-test="window.jQuery && window.jQuery.validator">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.6/jquery.validate.unobtrusive.min.js"
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive">
</script>
</environment>
Most helpful comment
For anyone that lands here in the mean time... I scaffolded a blank asp.net core project and found that the file should look like:
Add a file
_ValidationScriptsPartial.cshtmltoViews/Sharedfolder with the following: