In my .csproj file I've added the following config:
<ItemGroup>
<None Include="$(USERPROFILE)\.nuget\packages\microsoft.data.sqlclient.sni\1.0.19235.1\buildTransitive\net46\x64\SNI.dll">
<!-- This is a workaround to include SNI.dll in the NuGet package resulting from the pipeline in Azure DevOps. -->
<Link>x64\SNI.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
But, it's been difficult to find documentation on how PreserveNewest
actually works. I've looked at various Stackoverflow posts, and found this page from the documentation, which states under the section for the None
element:
CopyToOutputDirectory Optional string. Determines whether to copy the file to the output directory. Values are:
- Never
- Always
- PreserveNewest
It's doesn't really describe how it works. Does anyone know this? By what criteria does it decide what is newest? File changed date? Other version metadata? What does it mean by "preserve"?
The aim of the config is to copy the SNI.dll
file to the bin/x64
directory, which it does successfully.