Hamburger Cross Icon
Project File Exists
+
.NET Collector

Project File Exists + .NET Collector

Guardrail Collector Stable Devex Build And Ci

Enforce Project File Exists using data collected by .NET Collector. Automatically check devex build and ci standards on every PR.

Guardrail: Ensures the project has at least one .NET project file (.csproj, .fsproj, .vbproj). Required for all .NET projects to be buildable.
Data Source: Analyze .NET projects to collect project structure, target frameworks, NuGet dependencies, and test project identification. Supports C#, F#, and VB.NET with SDK-style and legacy projects.

How .NET Collector Powers This Guardrail

The .NET Collector gathers metadata from your languages, build systems. This data flows into Lunar's Component JSON, where the Project File Exists guardrail evaluates it against your standards.

When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.

1
.NET Collector Gathers Data Collector
Extracts metadata from code, configs, and tool outputs
2
{ } Component JSON
Data centralized in structured format for evaluation
3
Project File Exists Checks Guardrail
Pass/fail result with actionable feedback in PRs

Quick Start Configuration

Add both the collector and policy to your lunar-config.yml to enable this guardrail.

📄 lunar-config.yml
# Step 1: Enable the .NET Collector
collectors:
  - uses: github://earthly/lunar-lib/collectors/dotnet@v1.0.5
    # with: ...

# Step 2: Enable the .NET Project Guardrails
policies:
  - uses: github://earthly/lunar-lib/policies/dotnet@v1.0.5
    include: [project-file-exists]
    # with: ...

What .NET Collector Collects

This collector gathers the following data that the Project File Exists guardrail evaluates.

Collector code

project

Detects .NET project structure including project files (.csproj, .fsproj, .vbproj), solution files (.sln), SDK configuration (global.json), MSBuild properties (Directory.Build.props), target frameworks, project types, and SDK versions. Writes project metadata to .lang.dotnet.

Collector code

dependencies

Extracts NuGet dependencies from project files, including direct dependencies, project references, and dependency locking status (packages.lock.json). Writes dependency data to .lang.dotnet.dependencies.

Collector ci-before-command

cicd

Records every dotnet command executed in CI pipelines along with the .NET SDK version. Writes command strings and version info to .lang.dotnet.cicd for audit trails and build reproducibility analysis.

Example Data Flow

Here's an example of the data that .NET Collector writes to the Component JSON, which Project File Exists then evaluates.

{ } component.json From .NET Collector
{
  "lang": {
    "dotnet": {
      "sdk_version": "8.0.100",
      "target_frameworks": ["net8.0"],
      "project_files": [
        {
          "path": "MyApp/MyApp.csproj",
          "type": "csharp",
          "output_type": "Exe",
          "target_framework": "net8.0"
        }
      ],
      "solution_files": ["MyApp.sln"],
      "global_json_exists": true,
      "directory_build_props_exists": false,
      "packages_lock_exists": true,
      "test_projects": [
        {
          "path": "MyApp.Tests/MyApp.Tests.csproj",
          "type": "csharp",
          "test_framework": "xunit"
        }
      ],
      "source": { "tool": "dotnet", "integration": "code" },
      "dependencies": {
        "direct": [
          {
            "name": "Microsoft.Extensions.Hosting",
            "version": "8.0.0",
            "type": "package"
          }
        ],
        "project_references": [
          {
            "path": "MyLibrary/MyLibrary.csproj"
          }
        ],
        "source": { "tool": "dotnet", "integration": "code" }
      },
      "cicd": {
        "cmds": [
          {"cmd": "dotnet restore", "version": "8.0.100"},
          {"cmd": "dotnet build --configuration Release", "version": "8.0.100"},
          {"cmd": "dotnet test --no-build", "version": "8.0.100"}
        ],
        "source": {"tool": "dotnet", "integration": "ci"}
      }
    }
  }
}

Configuration Options

.NET Project Guardrails Inputs

Input Required Default Description
min_sdk_version Optional 8.0 Minimum .NET SDK version required for the project
min_sdk_version_cicd Optional 8.0 Minimum .NET SDK version required for CI/CD pipelines

Ready to Automate Your Standards?

See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 100+ built-in guardrails.

Works with any process
check AI agent rules & prompt files
check Post-mortem action items
check Security & compliance policies
check Testing & quality requirements
Automate Now
Paste your AGENTS.md or manual process doc and get guardrails in minutes
Book a Demo