Remove manual DLL copy from ILCompiler build task (#79783)
authorAndy Gocke <angocke@microsoft.com>
Tue, 31 Jan 2023 23:04:17 +0000 (15:04 -0800)
committerGitHub <noreply@github.com>
Tue, 31 Jan 2023 23:04:17 +0000 (15:04 -0800)
Rather than manually copying DLLs from the NuGet package directory
we can just set an MSBuild property to copy package dependencies
to the build output. This is also safer since it includes all the
transitive dependencies.

src/coreclr/tools/aot/ILCompiler.Build.Tasks/ILCompiler.Build.Tasks.csproj

index 7f9ebf2..c5aab2b 100644 (file)
@@ -8,30 +8,23 @@
     <OutputPath>$(RuntimeBinDir)/ilc-published/netstandard</OutputPath>
     <Configurations>Debug;Release;Checked</Configurations>
     <PlatformTarget>AnyCPU</PlatformTarget>
-
-    <!-- Workaround for https://github.com/dotnet/corert/issues/6306 -->
-    <SkipSigning>true</SkipSigning>
+    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
   </PropertyGroup>
 
   <ItemGroup>
     <PackageReference Include="Microsoft.Build.Framework">
       <Version>15.3.409</Version>
+      <PrivateAssets>all</PrivateAssets>
+      <ExcludeAssets>runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Microsoft.Build.Utilities.Core">
       <Version>15.3.409</Version>
+      <PrivateAssets>all</PrivateAssets>
+      <ExcludeAssets>runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="System.Reflection.Metadata">
       <Version>$(SystemReflectionMetadataVersion)</Version>
     </PackageReference>
   </ItemGroup>
 
-  <ItemGroup>
-    <!-- Note that S.R.M depends on S.C.I. Their versions have to be in sync. -->
-    <Content Include="$(NuGetPackageRoot)\system.reflection.metadata\$(SystemReflectionMetadataVersion)\lib\netstandard2.0\System.Reflection.Metadata.dll">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-    <Content Include="$(NuGetPackageRoot)\system.collections.immutable\$(SystemCollectionsImmutableVersion)\lib\netstandard2.0\System.Collections.Immutable.dll">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
-  </ItemGroup>
 </Project>