formatc
formatc

Reputation: 4323

Including Build action content files directory from referenced assembly at same level as bin directory

I am trying to copy folder from referenced assembly to same level as bin directory in calling mvc application:

MyDLL1
  Shared
     image.png(Build action = content, Copy Always)


MyMvcApp(references MyDLL1)
  Images
  Content
  etc...
  bin
  (shared should be copied here)

So if I set up ../ As output path in MyDLL1 setting I am able to get shared folder created in bin directory of MyMvcApp after build,but if I put ../../, folder doesn't appear anywhere within MyMvcApp directory. Is it possible to get that folder created at same level as bin folder in MyMvcApp?

Upvotes: 1

Views: 1019

Answers (1)

formatc
formatc

Reputation: 4323

I removed reference to dll since it cointained only static files and added following to postbuild event to MyMvcApp:

start xcopy "$(SolutionDir)MyDLL1\Shared\*" "$(SolutionDir)MyMvcApp\Shared" /r /s /i /y
  • Start xcopy - runs xcopy in cmd as admin (solves exit code 4 for me)
  • \* - copies everything from shared folder
  • /s - tells it to copy folders and subfolders
  • /i - tells it target path is a directory (otherwise cmd would ask you is target path file or directory)
  • /r - overwrite readonly files
  • /y - overwerite files (otherwise cmd would ask if you want to overwrite each file..)

Upvotes: 2

Related Questions