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

£可爱£侵袭症+ 提交于 2019-12-23 04:04:22

问题


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?


回答1:


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..)


来源:https://stackoverflow.com/questions/16761730/including-build-action-content-files-directory-from-referenced-assembly-at-same

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!