0

I have some files setup to copy to the output directory on build. When I do a build the files are copied as expected. If I check the build log I can see the file being moves from the specific project it lives in to the web project bin folder.

 Copying file from "C:\Users\myUser\Source\Repos\MySolution\MyProject\Scripts\SomeScript.sql" to "bin\Scripts\SomeScript.sql".

For some reason though as soon as I click "Run" the bin folder gets cleared out, and on this build the files are not copied to the bin folder.

What could be the difference between a build and a run that would cause the files not be copied during a run?

Josh
  • 1,648
  • 8
  • 27
  • 58
  • When this happens to me, it is usually because the relative paths point to distinct directories. But: If this is a web project - and it looks like ASP.NET MVC !! - the Scripts folder is a magic folder that is to be used only for storing Javascript files, and the MVC framework would automatically manage these. Do not randomly put your .sql - Files there! They belong into the Content dir. – mischka Jan 24 '17 at 15:43
  • I changed the folder name to SQLScripts and same result. – Josh Jan 24 '17 at 16:28
  • Again everything copies correctly on a build, just not on a "run". What difference is there between build and run? – Josh Jan 24 '17 at 19:12
  • Did you just rename the scripts folder? this makes me nervous... there should be no difference between run and build, as long as you use the same configuration (debug/active) both times. There is a "Configuration Manager" in Visual Studio, that lets you revise those settings. If you don't find any build/run actions there, that explain the behavior , I would just start over with a blank solution and see if the issue reproduces. – mischka Jan 25 '17 at 12:58
  • You're misunderstanding a bit. These scripts were never in the "Scripts" folder of an MVC website. They are in a folder called "Scripts" of a project that is referenced from an MVC website, not the MVC project itself. Ultimately they get copied to the MVC projects output directory because the project is references from the MVC project. I'm failry certain the issue has nothing to do with the Scripts folder being special in MVC. – Josh Jan 25 '17 at 14:18

0 Answers0