/

.NET CI/CD & Docker Integration

Integrate ByteHide Monitor into your .NET CI/CD pipeline for automated protected builds.


Overview

Monitor is included as a NuGet package, so it is restored and built automatically in your CI/CD pipeline. No special build steps are needed. Just ensure your project builds successfully.

If you use cloud configuration, set the BYTEHIDE_TOKEN environment variable so the application can fetch its configuration at runtime.


GitHub Actions

YAML
name: Build .NET App

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Setup .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: '8.0.x'

      - name: Restore & Build
        run: dotnet build --configuration Release

      - name: Test
        run: dotnet test --configuration Release --no-build

      - name: Publish
        run: dotnet publish --configuration Release --output ./publish

Docker

DOCKERFILE
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY . .
RUN dotnet restore
RUN dotnet publish -c Release -o /app

FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app .

# Set token for cloud configuration (or use monitor-config.json)
ENV BYTEHIDE_TOKEN=""

ENTRYPOINT ["dotnet", "YourApp.dll"]

Token in Docker

For Docker deployments, pass the token at runtime via environment variable rather than baking it into the image: docker run -e BYTEHIDE_TOKEN=your-token your-image.


Azure DevOps

YAML
trigger:
  - main

pool:
  vmImage: 'ubuntu-latest'

steps:
  - task: UseDotNet@2
    inputs:
      packageType: 'sdk'
      version: '8.0.x'

  - script: dotnet build --configuration Release
    displayName: 'Build'

  - script: dotnet test --configuration Release --no-build
    displayName: 'Test'

  - script: dotnet publish --configuration Release --output $(Build.ArtifactStagingDirectory)
    displayName: 'Publish'

  - task: PublishBuildArtifacts@1
    inputs:
      pathToPublish: $(Build.ArtifactStagingDirectory)
      artifactName: 'app'

GitLab CI

YAML
build_dotnet:
  stage: build
  image: mcr.microsoft.com/dotnet/sdk:8.0
  script:
    - dotnet restore
    - dotnet build --configuration Release
    - dotnet publish --configuration Release --output ./publish
  artifacts:
    paths:
      - publish/

Key Points

  • Monitor is a standard NuGet package, no special build steps required
  • For cloud configuration, ensure BYTEHIDE_TOKEN is available at runtime (not build time)
  • For JSON configuration, include monitor-config.json in your published output
  • Store tokens as secrets in your CI/CD platform. Never commit them to source control
Previous
Mobile Apps