dotnet / dotnet/Scaffolding

.NET 8 Blazor CRUD scaffolding reports success but does not generate Razor files

Open
#3,813 0 comments 0 reactions 1 assignee Claimed by @MohamedFasulAshab View on GitHub
area-scaffolding customer-reported
Dominant language
C#
Stars
818
Forks
260
Avg merge
1d 8h
Merged PRs (30d)
10

Description

## Description

Blazor CRUD scaffolding for a .NET 8 Blazor application completes successfully and reports that Razor files were generated. However, no CRUD Razor files are actually created in the target project.

The issue reproduces consistently through both Visual Studio scaffolding and the `dotnet scaffold` CLI.

The same workflow works correctly for a .NET 10 Blazor application.

---

## Reproduction Steps

### Create a .NET 8 Blazor application

```bash
dotnet new blazor -n BlazorCrudNet8 -f net8.0
```

### Add a sample model

Create `Models/Employee.cs`:

```csharp
namespace BlazorCrudNet8.Models;

public class Employee
{
public int Id { get; set; }

[Required]
[MaxLength(100)]
public string? Name { get; set; }

[Required]
[DataType(DataType.Date)]
public DateTime? DateOfBirth { get; set; }

[Required]
[MaxLength(255)]
public string? EmailAddress { get; set; }

public bool IsActive { get; set; }
}
```

### Generate Blazor CRUD pages

#### Visual Studio

```text
Right Click Project
→ Add
→ New Scaffolded Item
→ Blazor CRUD
```

Use:

```text
Model Class : Employee
Data Context : AppDbContext
Database Provider: sqlite-efcore
Page : CRUD
```

#### CLI

```bash
dotnet scaffold aspnet blazor-crud \
--project ".csproj" \
--model Employee \
--dataContext AppDbContext \
--dbProvider sqlite-efcore \
--page CRUD
```

---

## Actual Result

Scaffolding completes successfully and reports:

```text
C:\Program Files\dotnet\dotnet.exe scaffold aspnet blazor-crud --model Employee --dataContext AppDbContext --dbProvider sqlite-efcore --page CRUD --project "D:\Blazor application\BlazorCrudNet8\BlazorCrudNet8.csproj"
Initializing scaffolding model...
Adding package 'Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter (v8.0.30)'...
Done
Adding package 'Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (v8.0.30)'...
Done
Adding package 'Microsoft.EntityFrameworkCore.Tools (v8.0.30)'...
Done
Adding package 'Microsoft.EntityFrameworkCore.Sqlite (v8.0.30)'...
Done
Adding AppDbContext.cs...
Done
Adding Blazor CRUD files (.razor)...
Done
Updating project 'BlazorCrudNet8'...
Done

```

The process exits successfully with exit code:

```text
0
```

However, no CRUD Razor pages are generated.

Current project structure:

```text
Components
└─ Pages
├─ Counter.razor
├─ Error.razor
├─ Home.razor
└─ Weather.razor
```

---

## Expected Result

CRUD Razor pages should be generated.

Expected project structure:

```text
Components
└─ Pages
└─ EmployeePages
├─ Create.razor
├─ Delete.razor
├─ Details.razor
├─ Edit.razor
└─ Index.razor
```

---

## Additional Notes

- Reproduced using Visual Studio scaffolding.
- Reproduced using `dotnet scaffold`.
- Reproduced using a locally built Scaffolding source build.
- Identity scaffolding works successfully for .NET 8.
- The issue is isolated to Blazor CRUD scaffolding.
- The tool reports successful generation even though no Razor files are created.

---

## Screenshots

### .NET 8 Scaffolding Log

Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.