Add generated resource source files to sourcelink PDBs (dotnet/coreclr#26394)
authorJuan Hoyos <juan.hoyos@microsoft.com>
Wed, 28 Aug 2019 20:46:03 +0000 (13:46 -0700)
committerGitHub <noreply@github.com>
Wed, 28 Aug 2019 20:46:03 +0000 (13:46 -0700)
* Add generated resource source files as embedded resources to sourcelink-enabled managed PDBs

Commit migrated from https://github.com/dotnet/coreclr/commit/e4a2b8e6de8a62a691a7af986bdd1ce6b53ddf18

src/coreclr/src/System.Private.CoreLib/System.Private.CoreLib.csproj

index 45ccb1e..cdcf267 100644 (file)
     <StrongNameKeyId>SilverlightPlatform</StrongNameKeyId>
   </PropertyGroup>
 
+  <!-- SourceLink -->
+  <PropertyGroup>
+    <!-- This is needed to embed build-time generated sources such as eventing and resource files to sourcelink PDBs. -->
+    <EmbedUntrackedSources>true</EmbedUntrackedSources>
+    <CoreCompileDependsOn>$(CoreCompileDependsOn);AddUntrackedResourcesForSourceLink</CoreCompileDependsOn>
+  </PropertyGroup>
+
   <!--
     Helper Paths
   -->
   <Target Name="CreateRuntimeRootIlLinkDescFile" BeforeTargets="CoreCompile" DependsOnTargets="_CreateILLinkRuntimeRootDescriptorFile">
   </Target>
 
+  <!-- This is working around dotnet/coreclr#26371 until dotnet/sourcelink#392 gets solved -->
+  <Target Name="AddUntrackedResourcesForSourceLink"
+    BeforeTargets="CoreCompile"
+    DependsOnTargets="SetEmbeddedFilesFromSourceControlManagerUntrackedFiles;
+                      _GenerateResxSource" >
+    <ItemGroup>
+      <EmbeddedFiles Include="@(GeneratedResxSource)" />
+    </ItemGroup>
+  </Target>
+
   <ItemGroup>
     <EmbeddedResource Include="$(_ILLinkRuntimeRootDescriptorFilePath)">
       <LogicalName>$(MSBuildProjectName).xml</LogicalName>