# Microsoft.VisualStudio.Web.CodeGeneration.Design

**Kind:** Service

**Source:** `Pams/Web/Pams.WebApp/Pams.WebApp.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`Microsoft.VisualStudio.Web.CodeGeneration.Design` is a NuGet package dependency for ASP.NET Core code generation and scaffolding workflows. The project references it during development so tooling can generate application files such as controllers, views, and data-access code.

## Diagram

```mermaid
sequenceDiagram
    participant Developer
    participant Project as Pams.WebApp.csproj
    participant Dotnet as dotnet aspnet-codegenerator
    participant Package as Microsoft.VisualStudio.Web.CodeGeneration.Design
    participant App as Generated Application Files

    Developer->>Project: Run scaffolding command
    Project->>Dotnet: Load project dependencies
    Dotnet->>Package: Load code generation design services
    Package->>App: Generate requested source files
    App-->>Developer: Write generated files to project
```

## Usage

```typescript
import { spawnSync } from "node:child_process";

const result = spawnSync(
  "dotnet",
  [
    "aspnet-codegenerator",
    "controller",
    "-name",
    "OrdersController",
    "-m",
    "Order",
    "-dc",
    "ApplicationDbContext",
    "--relativeFolderPath",
    "Controllers",
  ],
  {
    cwd: "Pams/Web/Pams.WebApp",
    stdio: "inherit",
  },
);

if (result.status !== 0) {
  throw new Error("ASP.NET Core scaffolding command failed.");
}
```

## AI Coding Instructions

- Keep `Microsoft.VisualStudio.Web.CodeGeneration.Design` as a project dependency when ASP.NET Core scaffolding commands are part of the development workflow.
- Run code generation from the directory containing `Pams.WebApp.csproj` so the generator resolves the correct project and dependencies.
- Review generated controllers, models, and views before committing them; scaffolding output may need project-specific authorization, validation, and routing changes.
- Do not reference this package from browser TypeScript code; it runs through .NET development tooling rather than application runtime code.

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (1)

- `Pams.WebApp` — `Pams/Web/Pams.WebApp/Pams.WebApp.csproj`:1
