instead of <Content>
use <ContentWithTargetPath>
and specify target path, like this:
<ItemGroup>
<ContentWithTargetPath Include="libsome_file.dat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>some_file.dat</TargetPath>
</ContentWithTargetPath>
<None Include="libsome_file.dat" />
</ItemGroup>
Note that this entry may not be visible from Visual Studio (2012, 2015, 2017), but once manually added to the csproj, it will appear in Visual Studio. The target path will not be editable through the UI though.
Adding a <None>
entry for the file will ensure that it still shows up in Visual Studio's UI.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…