2

I have an MVC project and would like to have the build output to a different directory. I have set the Output Path in the project properties and this takes care of where all the .DLL's are deployed but how do I have my Views and Content folders move there as well?

I realize I could use post-build events to move the files but I feel like there is an easier way (which I may have done before...).

Ryan Bosinger
  • 1,832
  • 2
  • 16
  • 25

2 Answers2

2

I ended up going with Post-build events because it was easy enough...

Robocopy $(ProjectDir)Views $(TargetDir)..\Views /s
Robocopy $(ProjectDir)Content $(TargetDir)..\Content /s
Copy $(ProjectDir)Web.config $(TargetDir)..\Web.config

This will still use output path variable set within the Visual Studio project properties. This was important to me because some team members are quite junior and I would like the set-up process to be straight forward.

Ryan Bosinger
  • 1,832
  • 2
  • 16
  • 25
1

A bit late but I think you need to set 'WebProjectOutputDir' too. For my project I have:

WebProjectOutputDir=ReleaseFolder 

and

OutDir=ReleaseFolder\bin
Joey
  • 1,752
  • 13
  • 17
  • This works, and should probably be marked as the accepted answer. I just added `$(OutputPath)\foo` to my `.csproj` file.Thanks! – infl3x Aug 17 '18 at 02:39