Search code examples
buildazure-devopsazure-pipelinespdb-filesbuildconfiguration

Azure DevOps - Enable .pdb file generation via VSBuild@1


I have a pubxml that is used in the VSBuild@1 task and the build works fine except I dont get my .pdb files. How can I make sure the .pdb files are also included in my release?

Project release Config

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Staging2|AnyCPU'">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DebugType>full</DebugType>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <LangVersion>default</LangVersion>
    <ErrorReport>prompt</ErrorReport>
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>

Pubxml file

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <PublishProvider>FileSystem</PublishProvider>
    <LastUsedBuildConfiguration>Staging2</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>Publish</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <TargetFramework>net472</TargetFramework>
    <DebugSymbols>True</DebugSymbols>
    <DebugType>Full</DebugType>
  </PropertyGroup>
</Project>

YAML build task

task: VSBuild@1
  inputs:
    solution: '**\MyApps\Main.csproj'
    msbuildArgs: '/t:build /p:DeployOnBuild=true /p:PublishProfile=publish.pubxml /p:OutputPath=$(build.artifactStagingDirectory)\MainPublish\'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)' 

Based on what I have looked up, if you can set the /Build=full property it will be fine. Well my question is if thats the case, where do I add it?


Solution

  • The MSBuild arguments equivalent of the <DebugType>Full</DebugType> part of the project file is: /p:DebugType=full.

    So, if you change your msbuildArgs section of the VSBuild task by adding /p:DebugType=full, this should do the trick.