![](/img/trans.png)
[英]How to setup a NuGet package to copy content files to output build directory?
[英]VS Code: How to copy files to output directory depending on build configurations
我剛剛用VS Code(C#、. NET Core)開始了一個新項目。 無論如何,我希望能夠像在Visual Studio中一樣將文件從項目目錄中復制到輸出目錄中。 但是我也想復制特定文件,具體取決於我是針對32位還是64位構建的。
我環顧四周,但到目前為止,無論我的構建配置如何,我所學到的都是復制文件。
<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>
腳步:
dotnet new console
創建控制台應用 .csproj
文件。 dotnet build -c Release -r win-x86
x-64
版本復制foo.xml
而針對兩個RID復制foo.txt
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.