1
votes

I have the following configuration in DevLocalPublish.pubxml:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>..\DevLocalPublish\</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <ExcludeGeneratedDebugSymbol>false</ExcludeGeneratedDebugSymbol>
  </PropertyGroup>

It works perfectly when I export through Visual Studio. The pdb files get exported to ..\DevLocalPublish\bin as expected. However, when I run this from msbuild, it doesn't work correctly. Here's the target I created:

  <Target Name="PublishDevLocally">
    <MSBuild Projects="KepsPortalMvc\KepsPortalMvc.csproj" Targets="Clean;Rebuild" Properties="_DebugSymbolsProduced=true;BuildProjectReferences=true;Configuration=Release;Platform=Any CPU;DeployOnBuild=true;PublishProfile=DevLocalPublish;ExcludeGeneratedDebugSymbol=false;OutputPath=..\DevLocalPublish"/>
  </Target>

I'm testing it with the following command:

msbuild direct.proj /t:PublishDevLocally

Everything else exports correctly. It's just the pdbs that aren't being published correctly. I've checked the bin folder in the project, and the pdbs are there, so the compiler is generated.

What am I doing wrong?

Edit: I've checked the obj\Release\Package\PackageTmp directory. I was able to get the pdb for the web project by adding the _DebugSymbolsProduced=true flag. However, it's not copying the pdbs of any of the referenced projects. I've uploaded PublishDevLocally to reflect my changes.

1

1 Answers

0
votes

Turns out I needed to add the property DebugSymbols=true; The final target is

  <Target Name="PublishDevLocally">
    <MSBuild Projects="KepsPortalMvc\KepsPortalMvc.csproj" Targets="Clean;Rebuild" Properties="DebugSymbols=true;BuildProjectReferences=true;Configuration=Release;Platform=Any CPU;DeployOnBuild=true;PublishProfile=DevLocalPublish;OutputPath=..\DevLocalPublish"/>
  </Target>