> For the complete documentation index, see [llms.txt](https://docs.sealights.io/knowledgebase/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/.net-core-agent/scanning-the-build-binaries.md).

# Scanning the build binaries

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

{% hint style="info" %}
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`.
{% endhint %}

## Generating a session ID <a href="#generating-a-session-id" id="generating-a-session-id"></a>

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

{% hint style="warning" %}
`--buildName` should reflect a meaningful version for the artifact you deploy.
{% endhint %}

{% tabs %}
{% tab title="PowerShell" %}
{% code overflow="wrap" %}

```powershell
.\sl-dotnet-agent\SL.DotNet.exe config --appName "my-app" --branchName "main" --buildName "$(Get-Date -Format 'yyyyMMdd_HHmm')" --includeNamespace "MyCompany.*" --buildSessionIdFile buildSessionId.txt --identifyMethodsByFqn
```

{% endcode %}
{% endtab %}

{% tab title="Azure DevOps" %}
{% code title="azure-pipelines.yml" overflow="wrap" %}

```yaml
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
```

{% endcode %}
{% endtab %}

{% tab title="Bash" %}
{% code overflow="wrap" %}

```bash
./sl-dotnet-agent/SL.DotNet config --appName "my-app" --branchName "main" --buildName "$(date +"%y%m%d_%H%M")" --includeNamespace "MyCompany.*" --buildSessionIdFile buildSessionId.txt --identifyMethodsByFqn
```

{% endcode %}
{% endtab %}

{% tab title="GitHub Actions" %}
{% code title=".github/workflows/dotnet.yml" overflow="wrap" %}

```yaml
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
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Scanning the binaries <a href="#scanning-the-binaries" id="scanning-the-binaries"></a>

Run the scan after the build completes.

{% tabs %}
{% tab title="PowerShell" %}
{% code overflow="wrap" %}

```powershell
.\sl-dotnet-agent\SL.DotNet.exe scan --buildSessionIdFile buildSessionId.txt --scanDir "C:\path\to\binaries" --ignoreGeneratedCode true
```

{% endcode %}
{% endtab %}

{% tab title="Azure DevOps" %}
{% code title="azure-pipelines.yml" overflow="wrap" %}

```yaml
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
```

{% endcode %}
{% endtab %}

{% tab title="Bash" %}
{% code overflow="wrap" %}

```bash
./sl-dotnet-agent/SL.DotNet scan --buildSessionIdFile buildSessionId.txt --scanDir "/path/to/binaries" --ignoreGeneratedCode true
```

{% endcode %}
{% endtab %}

{% tab title="GitHub Actions" %}
{% code title=".github/workflows/dotnet.yml" overflow="wrap" %}

```yaml
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
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="warning" %}
The `scanDir` folder must contain all the project’s PDB files.
{% endhint %}

{% hint style="info" %}
See [Command Reference](/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/.net-core-agent/command-reference.md) for full parameter details.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sealights.io/knowledgebase/setup-and-configuration/sealights-agents-and-plugins/.net-core-agent/scanning-the-build-binaries.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
