# Microsoft.CSharp

**Kind:** Service

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

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

NuGet package dependency

Microsoft.CSharp is a NuGet package dependency declared by `Pams.Security.csproj`. It supplies C# runtime binding support for `Pams.Security` code that performs dynamic C# operations. The dependency is managed through the project's legacy package and reference format.

## Diagram

```mermaid
sequenceDiagram
    participant Project as Pams.Security.csproj
    participant NuGet as NuGet Restore
    participant Package as Microsoft.CSharp
    participant Binder as C# Runtime Binder

    Project->>NuGet: Restore package dependency
    NuGet->>Package: Resolve Microsoft.CSharp
    Package-->>Project: Add assembly reference
    Project->>Binder: Execute dynamic C# operation
    Binder-->>Project: Return bound operation result
```

## Usage

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

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

const hasMicrosoftCSharp = /Microsoft\.CSharp/.test(projectXml);

if (!hasMicrosoftCSharp) {
  throw new Error(
    "Microsoft.CSharp is not declared in Pams.Security.csproj."
  );
}

console.log("Microsoft.CSharp dependency is declared.");
```

## AI Coding Instructions

- Keep the `Microsoft.CSharp` dependency aligned with the legacy package or assembly reference style already used by `Pams.Security.csproj`.
- Check whether dynamic C# usage requires this dependency before removing or changing its reference.
- Restore NuGet packages after editing `Pams.Security.csproj` so the Microsoft.CSharp assembly is available during builds.
- Avoid adding JavaScript or TypeScript package references for this dependency; it is consumed by the .NET project.
