The copyToOutput
setting works fine for me (at least in dotnet 1.0.0-preview3-003171
on Windows). Note however that copyToOutput is not transitive - meaning tath if the files are copied in project A, they won't be copied to output in project B that references project A.
Another method is to use underlying file system and create a symbolic link to the shared file or folder. On Linux it would be:
> ln -s ../Common.Includes common
Windows has a similar (but less commonly used) feature:
> mklink /J common ..\Common.Includes
You can then configure dotnet
to run it on a specific event:
"scripts": {
"precompile": "cmd /C mklink /J common ..\\Common.Includes"
}
In RC1 there were also events like 'prepare' or 'prerestore', which would be more suitable for this, but for now they're gone and dotnet
only supports 'precompile' and 'postcompile'.
It will be even better to put this command into a separate script along with some logic to check if the link already exists. On windows, I would create init.ps1
Powershell script:
if (!(Test-Path "common")) {
cmd /C mklink /J "common" "..\Common.Includes"
}
Then reference it from "scripts":
"scripts": {
"precompile": "init.ps1"
}