dotnet / Scaffolding

Code generators to speed up development.
MIT License
632 stars 226 forks source link

MVC Bootstrap 5 scaffolding for Edit view uses obsolete .form-group class #1985

Open pauldbentley opened 2 years ago

pauldbentley commented 2 years ago

Microsoft.VisualStudio.Web.CodeGeneration.Design version: 6.0.8 Target framework: .NET 6.0 Operating system: Windows 10 IDE: Visual Studio 2022 17.3.0

When scaffolding an Edit view, the generated cshtml includes the .form-group class which has been removed from Bootstrap 5:

https://getbootstrap.com/docs/5.0/migration/

Breaking: Dropped form-specific layout classes for our grid system. Use our grid and utilities instead of .form-group, .form-row, or .form-inline.

This means the spacing isn't correct on the generated HTML

<div class="form-group">
    <label asp-for="Id" class="control-label"></label>
    <input asp-for="Id" class="form-control" />
    <span asp-validation-for="Id" class="text-danger"></span>
</div>
danroth27 commented 1 year ago

@vijayrkn @sayedihashimi Looks like our scaffolded content still has this issue. Can we get this addressed?

danroth27 commented 1 year ago

Also control-label should be form-label: https://getbootstrap.com/docs/5.3/forms/overview/#overview