For the complete documentation index, see llms.txt. This page is also available as Markdown.

Scanning the build binaries

Create a build session ID and scan your .NET binaries before running tests.

The SeaLights .NET agent can scan the binaries after the build process to gather the build structure.

The examples below assume you downloaded the self-contained agent into ./sl-dotnet-agent. If you use a framework-dependent package, prefix the command with dotnet.

Generating a session ID

Before running the scan and tests, create a session ID. Use the same session ID across the full build and test cycle.

.\sl-dotnet-agent\SL.DotNet.exe config --appName "my-app" --branchName "main" --buildName "$(Get-Date -Format 'yyyyMMdd_HHmm')" --includeNamespace "MyCompany.*" --buildSessionIdFile buildSessionId.txt --identifyMethodsByFqn
azure-pipelines.yml
steps:
  - pwsh: |
      .\sl-dotnet-agent\SL.DotNet.exe config `
        --token "$(SEALIGHTS_AGENT_TOKEN)" `
        --appName "$(Build.Repository.Name)" `
        --branchName "$(Build.SourceBranchName)" `
        --buildName "$(Build.BuildNumber)" `
        --includeNamespace "MyCompany.*" `
        --buildSessionIdFile buildSessionId.txt `
        --identifyMethodsByFqn
    displayName: Create .NET build session ID
./sl-dotnet-agent/SL.DotNet config --appName "my-app" --branchName "main" --buildName "$(date +"%y%m%d_%H%M")" --includeNamespace "MyCompany.*" --buildSessionIdFile buildSessionId.txt --identifyMethodsByFqn
.github/workflows/dotnet.yml
jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Create .NET build session ID
        shell: bash
        run: |
          ./sl-dotnet-agent/SL.DotNet config \
            --token "${{ secrets.SEALIGHTS_AGENT_TOKEN }}" \
            --appName "${{ github.event.repository.name }}" \
            --branchName "${GITHUB_REF_NAME}" \
            --buildName "${GITHUB_RUN_NUMBER}" \
            --includeNamespace "MyCompany.*" \
            --buildSessionIdFile buildSessionId.txt \
            --identifyMethodsByFqn

Scanning the binaries

Run the scan after the build completes.

.\sl-dotnet-agent\SL.DotNet.exe scan --buildSessionIdFile buildSessionId.txt --scanDir "C:\path\to\binaries" --ignoreGeneratedCode true
azure-pipelines.yml
steps:
  - pwsh: |
      .\sl-dotnet-agent\SL.DotNet.exe scan `
        --token "$(SEALIGHTS_AGENT_TOKEN)" `
        --buildSessionIdFile buildSessionId.txt `
        --scanDir "$(Build.SourcesDirectory)\src\MyApp\bin\Release" `
        --ignoreGeneratedCode true
    displayName: Scan .NET binaries
./sl-dotnet-agent/SL.DotNet scan --buildSessionIdFile buildSessionId.txt --scanDir "/path/to/binaries" --ignoreGeneratedCode true
.github/workflows/dotnet.yml
jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Scan .NET binaries
        shell: bash
        run: |
          ./sl-dotnet-agent/SL.DotNet scan \
            --token "${{ secrets.SEALIGHTS_AGENT_TOKEN }}" \
            --buildSessionIdFile buildSessionId.txt \
            --scanDir "./src/MyApp/bin/Release" \
            --ignoreGeneratedCode true

See Command Reference for full parameter details.

Last updated

Was this helpful?