asp.net core and including shared content files -


i have shared project project contains content files json, etc.

i have number of asp.net core projects , want include/share of these json files. simple "link file" option in vs it's not available in asp.net core projects.

i've tried playing buildoptions/copytooutput follows not seem working , no error or warning logged in build process.

"copytooutput": {     "include": [ "../common.includes/mysettings*.json" ] } 

any ideas gratefully accepted?

thanks

donal

the copytooutput setting works fine me (at least in dotnet 1.0.0-preview3-003171 on windows). note copytooutput not transitive - meaning tath if files copied in project a, won't copied output in project b references project a.

another method use underlying file system , create symbolic link shared file or folder. on linux be:

> ln -s ../common.includes common 

windows has similar (but less commonly used) feature:

> mklink /j common ..\common.includes 

you can configure dotnet run on specific event:

"scripts": {     "precompile": "cmd /c mklink /j common ..\\common.includes" } 

in rc1 there events 'prepare' or 'prerestore', more suitable this, they're gone , dotnet supports 'precompile' , 'postcompile'.

it better put command separate script along logic check if link exists. on windows, create init.ps1 powershell script:

if (!(test-path "common")) {     cmd /c mklink /j "common" "..\common.includes" } 

then reference "scripts":

"scripts": {     "precompile": "init.ps1" } 

Comments