John-Luke Laue
John-Luke Laue

Reputation: 3856

.NET Core project.json copyToOutput file in parent directory

I need to include a file in my build output. This file is two folders above project.json. If I specify this using "../../", the config file is copied over, but to the wrong location. Instead of being copied over to /bin/Debug/net461, it's placed two folders higher in /bin.

How do I get a file in a parent directory to be copied over to actual output folder where the dlls are placed?

"buildOptions": {
  "copyToOutput": { "includeFiles": [ "../../config.json" ] }
},

Upvotes: 0

Views: 718

Answers (1)

M. Wiśnicki
M. Wiśnicki

Reputation: 6203

Try use this instead, it's tested way and working very well:

  "buildOptions": {
     "copyToOutput": "project.json",
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  }

You can use copy single file "copyToOutput":"name" or array "copyToOutput":["name1","name2"]. To copy directory need to use "copyToOutput":"name\\"

Upvotes: 1

Related Questions