MsBuild not generating PDB files in Release configuration

后端 未结 3 2073
一整个雨季
一整个雨季 2021-02-14 06:35

相关标签:
3条回答
  • 2021-02-14 07:04

    After looking at the Microsoft.Web.Publishing.targets source, I have found a variable (ExcludeGeneratedDebugSymbol) being set to True in Release mode. From the comments, it looks like they wanted to exclude symbols from WebSite project, but the condition is not properly set for WebApplication project.

    So, I have decided to override my build scrip from the caller arguments and it worked like a charm. I have not yet ascertained any side affects it may cause or using the undocumented property for future stability, but it works for now.

    From the Microsoft.Web.Publishing.target file

    <!--For website we will always exclude debug symbols from publishing unless it is set explicitly by user in website publish profile-->
        <ExcludeGeneratedDebugSymbol Condition="'$(ExcludeGeneratedDebugSymbol)'=='' And '$(_WebProjectType)' == 'WebSite'">True</ExcludeGeneratedDebugSymbol>
    
        <ExcludeGeneratedDebugSymbol Condition="'$(ExcludeGeneratedDebugSymbol)'=='' And '$(Configuration)' == 'Release'">True</ExcludeGeneratedDebugSymbol>
        <ExcludeGeneratedDebugSymbol Condition="'$(ExcludeGeneratedDebugSymbol)'==''">False</ExcludeGeneratedDebugSymbol>
    

    I have updated my script as follows.

    <MSBuild Projects="$(ProjectFile)"  Targets="_WPPCopyWebApplication;"
    Properties="OutDir=..\publish;Configuration=Release;Platform=AnyCPU"; ExcludeGeneratedDebugSymbol=false />
    
    0 讨论(0)
  • 2021-02-14 07:11

    You can put this directly in your *.csproj file, as the last property group section (right before the Import elements):

    <PropertyGroup>
      <ExcludeGeneratedDebugSymbol Condition="$(DebugSymbols) == true">false</ExcludeGeneratedDebugSymbol>
    </PropertyGroup>
    
    0 讨论(0)
  • 2021-02-14 07:21

    You could also updated your publish profile (.pubxml) file to include that property value. I had to do this today with the new build bits in TFS Build 2015 to have the web publishing include the .pdb files. See example contents of file with property added to bottom.

    <?xml version="1.0" encoding="utf-8"?>
    <!--
    This file is used by the publish/package process of your Web project. You can customize the behavior of this process
    by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. 
    -->
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <PropertyGroup>
        <WebPublishMethod>FileSystem</WebPublishMethod>
        <SiteUrlToLaunchAfterPublish />
        <publishUrl>C:\Publish</publishUrl>
        <DeleteExistingFiles>True</DeleteExistingFiles>
        <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
        <LastUsedPlatform>Any CPU</LastUsedPlatform>
        <ExcludeApp_Data>False</ExcludeApp_Data>
        <LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
        <ExcludeGeneratedDebugSymbol>false</ExcludeGeneratedDebugSymbol>
      </PropertyGroup>
    </Project>
    
    0 讨论(0)
提交回复
热议问题