Copying the file to a .NET Core.csproj file

I created a new .NET Class Library project in .NET Core on Mac OS X. During the build of the project, I would like to copy the file to the debug directory. How do I add this to the file .csproj

?

.NET Command Line Tools (1.0.1)

Product Information:
Version:            1.0.1
Commit SHA-1 hash:  005db40cd1

Runtime Environment:
OS Name:     Mac OS X
OS Version:  10.12
OS Platform: Darwin
RID:         osx.10.12-x64
Base Path:   /usr/local/share/dotnet/sdk/1.0.1

      

0


source to share


1 answer


As with the file .csproj

, MSBuild is used again, this can be done using MSBuild elements. You need to add an attribute CopyToOutputDirectory

to the corresponding element and indicate when to copy (Always, PreserveNewest, Never).

Sample section in .csproj file (from here ):



<ItemGroup>
    <None Include="notes.txt" CopyToOutputDirectory="Always" />
    <!-- CopyToOutputDirectory = { Always, PreserveNewest, Never } -->

</ItemGroup>

      

+7


source







All Articles