# System.Net.Http.WebRequest

**Kind:** Service

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

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

NuGet package dependency

`System.Net.Http.WebRequest` is a NuGet package dependency declared by the `Pams.Email` project. It supplies the .NET WebRequest API surface needed when email code or its dependencies make legacy HTTP requests. The package is restored during the `Pams.Email` project build rather than imported directly by TypeScript or JavaScript.

## Diagram

```mermaid
sequenceDiagram
    participant Script as Build Script
    participant Dotnet as dotnet CLI
    participant Project as Pams.Email.csproj
    participant NuGet as NuGet Feed
    participant Email as Pams.Email Assembly

    Script->>Dotnet: dotnet restore project
    Dotnet->>Project: Read package references
    Project->>NuGet: Request System.Net.Http.WebRequest
    NuGet-->>Dotnet: Restore package assets
    Dotnet->>Email: Build with restored dependency
```

## Usage

```ts
import { execFileSync } from "node:child_process";

const projectPath = "Pams/Logic/Pams.Email/Pams.Email.csproj";

// Restores System.Net.Http.WebRequest and other project dependencies.
execFileSync("dotnet", ["restore", projectPath], {
  stdio: "inherit",
});

// Builds Pams.Email with the restored package available.
execFileSync("dotnet", ["build", projectPath], {
  stdio: "inherit",
});
```

## AI Coding Instructions

- Treat `System.Net.Http.WebRequest` as a project dependency; do not import it from TypeScript or JavaScript.
- Restore the `Pams.Email` project after changing its package references or target framework settings.
- Check existing email and HTTP code before replacing WebRequest-based behavior with newer .NET HTTP APIs.
- Keep package-reference changes scoped to `Pams.Email.csproj` unless another project also requires the dependency.
