Skip to content

Commit fe05ba9

Browse files
Fix LT-22220: Copy Nuget System.Buffers post build
* The GAC version of System.Buffers was being copied during project builds making the version of Visual Studio on the build system determine what version of Buffers ended up in the Build Output. Rather than add a direct reference to every project that might pull it in as a tertiary dependency add a post build copy
1 parent c7d8735 commit fe05ba9

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Src/Directory.Build.targets

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
<Project>
2-
<!-- .Net Framework projects which reference netstandard2.0 end up copying a bad version of System.ValueTuple -->
2+
<!-- .Net Framework projects which reference netstandard2.0 end up copying a bad version of some System libraries -->
33
<!-- Rather than try to fix it here and there we'll just go nuclear and copy the right one in after every project -->
4-
<Target Name="CopyCorrectSystemValueTuple" AfterTargets="Build">
4+
<Target Name="CopyCorrectSystemAssemblies" AfterTargets="Build">
55
<ItemGroup>
6-
<TupleAssembly Include="$(MSBuildThisFileDirectory)/../packages/System.ValueTuple.4.5.0/lib/net461/System.ValueTuple.dll" />
6+
<SystemAssembly Include="$(MSBuildThisFileDirectory)/../packages/System.ValueTuple.4.5.0/lib/net461/System.ValueTuple.dll" />
7+
<SystemAssembly Include="$(MSBuildThisFileDirectory)/../Downloads/System.Buffers.dll" />
78
</ItemGroup>
8-
<Message Text="Copying @(TupleAssembly) to $(OutDir)" />
9+
<Message Text="Copying @(SystemAssembly) to $(OutDir)" />
910
<Error
1011
Text="System.ValueTuple not found in the packages folder."
1112
Condition="!Exists('$(MSBuildThisFileDirectory)/../packages/System.ValueTuple.4.5.0/lib/net461/System.ValueTuple.dll')" />
12-
<Copy SourceFiles="@(TupleAssembly)" DestinationFolder="$(OutDir)" />
13+
<Error
14+
Text="System.Buffers not found in the downloads folder."
15+
Condition="!Exists('$(MSBuildThisFileDirectory)/../Downloads/System.Buffers.dll')" />
16+
<Copy SourceFiles="@(SystemAssembly)" DestinationFolder="$(OutDir)" SkipUnchangedFiles="true" />
1317
</Target>
1418
</Project>

0 commit comments

Comments
 (0)