I just started a new project in VS Code (C#, .NET Core). Anyways, I want to be able to copy files from within my project directory to the output directory like I can in visual studio. But I also want to copy specific files depending on whether or not I'm building for 32 or 64 bit.
I've looked around but so far all I've learnt how to do is copy files regardless of my build configurations.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'win-x86' Or '$(RuntimeIdentifier)' == 'win-x64'">
<None Update="foo.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
<None Update="foo.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
Steps:
dotnet new console
.csproj
file as above.dotnet build -c Release -r win-x86
foo.xml
is copied only for a x-64
build whereas foo.txt
is copied for both RID'sIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With