如果是设置某个文件,直接右键属性设置即可,在*.csproj文件中会生成如下代码
<ItemGroup>
<Content Update="ViewsTaskBackGroundIndex.cshtml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
但是当文件很多的时候,这样一个一个的设置就很扯了,解决方法是变通一下,改成如下即可
<ItemGroup>
<Content Include="Utility*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>