Skip to content

Instantly share code, notes, and snippets.

@Cody-Duncan
Last active August 29, 2015 14:14
Show Gist options
  • Save Cody-Duncan/cea6c7d5c4abe369d6b6 to your computer and use it in GitHub Desktop.
Save Cody-Duncan/cea6c7d5c4abe369d6b6 to your computer and use it in GitHub Desktop.
Typical Visual Studio PostBuild and Output Directory Settings
//PostBuild Event
// Copies .dll, .pdb, and .exe files from a directory named "dll" to output folder.
// Often, "dll" will be "lib", depending on where you put your .dll files.
// /F Display full source and destination file names while copying.
// /Y Suppress prompt to confirm overwriting a file.
// /D Copy only files whosesource date/time is newer than the destination time.
// $(SolutionDir) - Visual Studio Macro; the directory the project .sln file is located
// $(TargetDir) - Visual Studio Macro; the directory that the built executable is written to
xcopy "$(SolutionDir)dll\*.dll" "$(TargetDir)" /F /Y /D
xcopy "$(SolutionDir)dll\*.pdb" "$(TargetDir)" /F /Y /D
xcopy "$(SolutionDir)dll\*.exe" "$(TargetDir)" /F /Y /D
//Commonly used Output Directory and Intermediate Directory settings.
// $(SolutionDir) - Visual Studio Macro; the directory the project .sln file is located
// $(Configuration) - Visual Studio Macro; name of the current configuratio being built (Debug / Release)
// $(ProjectName) - Visual Studio Macro; Name of the vcxproj file.
// -Typically use these settings for every project in the solution.
// -It's typically bad practice to use relative addresses, like ..\bin, because that implies a strict location of
// the vcxproj file. Often it is safer to use SolutionDir as the root of the path and emplace the
// binaries and intermediate files from there.
// -It's advantageous to have a dedicated bin and obj folder so that all the compilation assets can be deleted at once.
// Visual Studio's "clean" or "rebuild" doesn't always clean out everything.
// -Must separate intermediate by project, or compiler will complain about sharing
// an intermediate directory between projects.
// For a Debug Build,
// the .exe : Directory\bin\Debug
// the intermediate files : Directory\Project\obj\Debug
$(SolutionDir)bin\$(Configuration)\
$(SolutionDir)obj\$(ProjectName)\$(Configuration)\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment