Do not package singlefilehost.exe in shared runtime
authorNikola Milosavljevic (CLR) <nikolam@microsoft.com>
Thu, 7 May 2020 21:36:44 +0000 (14:36 -0700)
committerNikola Milosavljevic (CLR) <nikolam@microsoft.com>
Thu, 7 May 2020 21:36:44 +0000 (14:36 -0700)
src/installer/pkg/projects/netcoreapp/sfx/Microsoft.NETCore.App.SharedFx.sfxproj

index d12d993..f1aab81 100644 (file)
 
   <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
 
+  <!-- Clean up artifacts that dotnet-publish generates which we don't need -->
+  <Target Name="DeleteUnnecessaryPublishOutputs" AfterTargets="Publish">
+    <ItemGroup>
+      <ToDelete Include="$(PublishDir)apphost$(ExeSuffix)" />
+      <ToDelete Include="$(PublishDir)singlefilehost$(ExeSuffix)" />
+      <ToDelete Include="$(PublishDir)$(LibPrefix)comhost$(LibSuffix)" />
+      <ToDelete Include="$(PublishDir)$(LibPrefix)hostfxr$(LibSuffix)" />
+      <ToDelete Include="$(PublishDir)$(LibPrefix)ijwhost$(LibSuffix)" />
+      <ToDelete Include="$(PublishDir)$(LibPrefix)nethost$(LibSuffix)" />
+      <ToDelete Include="$(PublishDir)$(LibPrefix)nethost.h" />
+      <!--
+        On Windows, LibSuffix is .dll (for dynamic libraries), but for this particular file, we also
+        build a .lib (static library). Make sure neither is included.
+
+        We only build this library on Windows, so other static library formats don't need to be
+        handled yet.
+      -->
+      <ToDelete Include="$(PublishDir)$(LibPrefix)ijwhost.lib" />
+      <ToDelete Include="$(PublishDir)$(LibPrefix)nethost.lib" />
+    </ItemGroup>
+
+    <Delete Files="@(ToDelete)" />
+  </Target>
+
   <!--
     Since the libraries configuration might be different than the installer configuration, we need to add additional restore sources
     to be able to find packages produced in the libraries phase and consumed in the installer phase.