How to Add LICENSE.txt to Your .NET Project Using Azure Pipelines
Including a license file in your NuGet package is a best practice that improves transparency and compliance for your open-source or internal packages. If you store your LICENSE.txt securely in Azure DevOps, you can automate its inclusion into your .NET project using Azure Pipelines. In this guide, I’ll walk you through how to: Download the LICENSE.txt from Azure DevOps secure files Copy the file into your project directory Modify the .csproj file dynamically to include the license file during build and packaging 🔐 Step 1: Download LICENSE.txt from Secure Files First, upload your LICENSE.txt to the Secure Files library in Azure DevOps. Then, in your YAML pipeline, use the DownloadSecureFile task to fetch it at runtime. - task: DownloadSecureFile@1 displayName: 'Download LICENSE.txt' inputs: secureFile: 'LICENSE.txt' This will download the file to a temporary location on the build agent ( $(Agent.Te...