# System.Web.WebPages.Razor

**Kind:** Service

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

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

NuGet package dependency

`System.Web.WebPages.Razor` is a NuGet package dependency declared in `Pams.API.csproj`. It supplies Razor Web Pages types used by the legacy ASP.NET application when compiling or executing Razor-based views and pages.

## Diagram

```mermaid
sequenceDiagram
    participant Build as Pams.API build
    participant Project as Pams.API.csproj
    participant NuGet as NuGet restore
    participant Razor as System.Web.WebPages.Razor
    participant Runtime as ASP.NET runtime

    Build->>Project: Read package dependency
    Project->>NuGet: Restore package
    NuGet->>Razor: Download assembly
    Build->>Runtime: Deploy application with Razor dependency
    Runtime->>Razor: Load Razor Web Pages types
```

## Usage

```typescript
import { readFile } from "node:fs/promises";

const projectFile = "Pams/API/Pams.API/Pams.API.csproj";
const projectXml = await readFile(projectFile, "utf8");

const hasRazorDependency = projectXml.includes("System.Web.WebPages.Razor");

if (!hasRazorDependency) {
  throw new Error(
    "System.Web.WebPages.Razor is required for Razor Web Pages support."
  );
}

console.log("Razor Web Pages package dependency is declared.");
```

## AI Coding Instructions

- Keep `System.Web.WebPages.Razor` package references compatible with the legacy ASP.NET target framework used by `Pams.API`.
- Check `Pams.API.csproj` before removing or updating this dependency because Razor pages or views may load its assemblies at runtime.
- Restore NuGet packages after changing package references so local builds include the Razor assembly.
- Do not replace this package with ASP.NET Core Razor packages without migrating the application framework and related view configuration.
