### Example of Using 1ES Official Templates with Multiple Outputs Source: https://github.com/dotnet/sourcelink/blob/main/eng/common/template-guidance.md This example demonstrates how to configure a pipeline to use 1ES official templates and consolidate publish artifacts within the Build.ArtifactStagingDirectory to reduce security scans. It shows the use of 'templateContext' with 'outputs' to define artifact publishing. ```yaml extends: template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate parameters: stages: - stage: build jobs: - template: /eng/common/templates-official/jobs/jobs.yml@self parameters: # 1ES makes use of outputs to reduce security task injection overhead templateContext: outputs: - output: pipelineArtifact displayName: 'Publish logs from source' continueOnError: true condition: always() targetPath: $(Build.ArtifactStagingDirectory)/artifacts/log artifactName: Logs jobs: - job: Windows steps: - script: echo "friendly neighborhood" > artifacts/marvel/spiderman.txt # copy build outputs to artifact staging directory for publishing - task: CopyFiles@2 displayName: Gather build output inputs: SourceFolder: '$(System.DefaultWorkingDirectory)/artifacts/marvel' Contents: '**' TargetFolder: '$(Build.ArtifactStagingDirectory)/artifacts/marvel' ``` -------------------------------- ### NuGet Package Manifest Example Source: https://github.com/dotnet/sourcelink/blob/main/docs/StandardCI/README.md Example of embedding source control information within a NuGet package's .nuspec file. This provides a manifest for the package's origin. ```xml ``` -------------------------------- ### Git Submodule Configuration Source: https://github.com/dotnet/sourcelink/blob/main/docs/README.md Example of .gitmodules file specifying submodule path and the corresponding URL in .git/config. ```plaintext [submodule "submodule-name"] path = submodule-path url = https://server.com/subrepo ``` -------------------------------- ### AssemblyInformationalVersion Attribute Example Source: https://github.com/dotnet/sourcelink/blob/main/docs/StandardCI/README.md Example of how to use the AssemblyInformationalVersion attribute to embed source control information in a .NET assembly. This is useful for auditing and debugging purposes. ```csharp [assembly: AssemblyInformationalVersion("2.4.0-beta1-62122-04+ab56a4a6c32268d925014a3e45ddce61fba715cd")] ``` -------------------------------- ### Add Gitweb SourceLink Package Source: https://github.com/dotnet/sourcelink/blob/main/README.md Include this package reference for projects hosted on-prem via gitweb. ```xml ``` -------------------------------- ### Configure Source Link for GitHub Source: https://github.com/dotnet/sourcelink/blob/main/docs/README.md Basic project configuration to enable repository URL detection, embed untracked sources, and include the GitHub Source Link package. ```xml netcoreapp2.1 true true ``` -------------------------------- ### Configure Source Link for C++ Projects Source: https://github.com/dotnet/sourcelink/blob/main/README.md Add these package references to your packages.config file to enable Source Link support in native projects. ```xml ``` -------------------------------- ### Add Gitea SourceLink Package Source: https://github.com/dotnet/sourcelink/blob/main/README.md Reference this package for projects hosted on-prem via gitea. ```xml ``` -------------------------------- ### Add Bitbucket Git SourceLink Package Source: https://github.com/dotnet/sourcelink/blob/main/README.md Reference this package for projects hosted on Bitbucket.org or an on-prem Bitbucket server. ```xml ``` -------------------------------- ### Add GitLab SourceLink Package Source: https://github.com/dotnet/sourcelink/blob/main/README.md Include this package reference for projects hosted on GitLab. ```xml ``` -------------------------------- ### Configure Source Link in .NET Projects Source: https://github.com/dotnet/sourcelink/blob/main/README.md Use this configuration in your .NET project if it does not use .NET SDK 8+ or is not hosted by a supported provider. It includes a PackageReference to a Source Link package and an optional PropertyGroup to embed untracked sources. ```xml true ``` -------------------------------- ### Add Source Link Initialization Target Source: https://github.com/dotnet/sourcelink/blob/main/docs/README.md Add a custom initialization target to `SourceLinkUrlInitializerTargets` in a .targets file. This target will update `SourceRoot` items with `SourceLinkUrl` metadata. ```xml $(SourceLinkUrlInitializerTargets);_InitializeXyzSourceLinkUrl ``` -------------------------------- ### Configure Bitbucket Host for Older Versions Source: https://github.com/dotnet/sourcelink/blob/main/README.md For Bitbucket Server or Data Center versions older than 4.7, specify the SourceLinkBitbucketGitHost item group with the domain and version. ```xml ``` -------------------------------- ### Configure Azure DevOps Server Git Host Source: https://github.com/dotnet/sourcelink/blob/main/README.md Provide the hostname of your Azure DevOps Server. The Include attribute specifies the domain and optionally the port. ```xml ``` -------------------------------- ### Configure GitLab Host for Older Versions Source: https://github.com/dotnet/sourcelink/blob/main/README.md For GitLab versions older than 12.0, specify the SourceLinkGitLabHost item group with the domain and version. ```xml ``` -------------------------------- ### Submodule Metadata Pointer Source: https://github.com/dotnet/sourcelink/blob/main/docs/README.md Content of the .git/modules//HEAD file and the pointer file within the submodule directory. ```plaintext .git/modules/submodule-name/HEAD submodule-path/.git ``` -------------------------------- ### Add Azure Repos Git SourceLink Package Source: https://github.com/dotnet/sourcelink/blob/main/README.md Include this package reference for projects hosted on Azure Repos (formerly Visual Studio Team Services) in Git repositories. ```xml ``` -------------------------------- ### Add Azure DevOps Server Git SourceLink Package Source: https://github.com/dotnet/sourcelink/blob/main/README.md Reference this package for projects hosted on-prem Azure DevOps Server (formerly Team Foundation Server) in Git repositories. ```xml ``` -------------------------------- ### Include PDBs in NuGet Package Source: https://github.com/dotnet/sourcelink/blob/main/README.md Add this property to your project file to include PDB files in the main NuGet package output. ```xml $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb ``` -------------------------------- ### Enable Source Link in Props File Source: https://github.com/dotnet/sourcelink/blob/main/docs/README.md Set `EnableSourceLink` to true in a .props file if it hasn't been set. This ensures Source Link is enabled by default. ```xml true ``` -------------------------------- ### Git Repository Minimal Structure Source: https://github.com/dotnet/sourcelink/blob/main/docs/README.md Minimal files and directories required in a Git repository for Source Link to function. Includes HEAD, config, and potentially .gitmodules for submodules. ```plaintext .git/HEAD .git/config .gitmodules ``` -------------------------------- ### Add Source Link GitHub Package Reference Source: https://github.com/dotnet/sourcelink/blob/main/README.md Reference the Microsoft.SourceLink.GitHub package for projects hosted on GitHub or GitHub Enterprise. Set PrivateAssets to 'All' as Source Link is a development dependency. ```xml ``` -------------------------------- ### Configure Azure DevOps Server Git Host with Virtual Directory Source: https://github.com/dotnet/sourcelink/blob/main/README.md If your Azure DevOps Server is configured with a non-empty IIS virtual directory, specify it using the VirtualDirectory attribute. ```xml ``` -------------------------------- ### Define Custom Source Link Host Domain Source: https://github.com/dotnet/sourcelink/blob/main/docs/README.md Assigns a specific domain to a Source Link provider when multiple providers are used or the host is on a custom domain. ```xml ``` -------------------------------- ### Override Default Content URL Source: https://github.com/dotnet/sourcelink/blob/main/docs/README.md Specifies a custom ContentUrl for a Source Link host when the default inferred URL is incorrect. ```xml ``` -------------------------------- ### Publish Repository URL in NuGet Package Manifest Source: https://github.com/dotnet/sourcelink/blob/main/README.md Set this property to true if your project produces a NuGet package. This will include source control information in the package manifest's NuSpec repository element, enabling source debugging for package consumers. ```xml true ``` -------------------------------- ### Embed PDBs in Assembly Source: https://github.com/dotnet/sourcelink/blob/main/README.md Set the DebugType property to embedded to include Portable PDB debug information directly within the assembly. ```xml embedded ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.