Scanning the build binaries
Create a build session ID and scan your .NET binaries before running tests.
Generating a session ID
.\sl-dotnet-agent\SL.DotNet.exe config --appName "my-app" --branchName "main" --buildName "$(Get-Date -Format 'yyyyMMdd_HHmm')" --includeNamespace "MyCompany.*" --buildSessionIdFile buildSessionId.txt --identifyMethodsByFqnsteps:
- 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 --identifyMethodsByFqnjobs:
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 \
--identifyMethodsByFqnScanning the binaries
.\sl-dotnet-agent\SL.DotNet.exe scan --buildSessionIdFile buildSessionId.txt --scanDir "C:\path\to\binaries" --ignoreGeneratedCode truesteps:
- 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 truejobs:
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 trueLast updated
Was this helpful?

