I do this with Visual Studio macros.
In the macro editor (Alt + F11) there is the EvironmentEvents file.
Here I use the BuildEvents_OnBuildProjConfigDone
event.
I use this all the time to copy assemlies to my working folder.
Example:
Private targetPath As String = "C:\..."
Private Sub BuildEvents_OnBuildProjConfigDone(ByVal ProjectName As String, ByVal ProjectConfig As String, ByVal Platform As String, ByVal SolutionConfig As String, ByVal Success As Boolean) Handles BuildEvents.OnBuildProjConfigDone
On Error GoTo ext
If Not Success Then Exit Sub
'Absolute path to assembly
Dim tar = targetPath
Dim project As Project = DTE.Solution.Projects.Item(ProjectName)
Dim projectFolder As String = Path.GetDirectoryName(project.FileName)
Dim config As EnvDTE.Configuration = project.ConfigurationManager.ActiveConfiguration
Dim outputPath As String = CStr(config.Properties.Item("OutputPath").Value)
Dim assemblyName As String = CStr(project.Properties.Item("AssemblyName").Value)
Dim assemblyFileName As String = CStr(project.Properties.Item("OutputFileName").Value)
Dim src As String = Path.Combine(Path.Combine(projectFolder, outputPath), assemblyFileName)
'Copy files to working folder
On Error GoTo err
Dim dst As String
dst = Path.Combine(tar, assemblyFileName)
DTE.ToolWindows.OutputWindow.ActivePane.OutputString(outTag + assemblyName + " -> " + dst + vbCrLf)
File.Copy(src, dst, True)
src = src.Substring(0, src.Length - 3) + "pdb"
dst = dst.Substring(0, dst.Length - 3) + "pdb"
DTE.ToolWindows.OutputWindow.ActivePane.OutputString(outTag + assemblyName + " -> " + dst + vbCrLf)
File.Copy(src, dst, True)
Exit Sub
err:
DTE.ToolWindows.OutputWindow.ActivePane.OutputString(outTag + Err.Description + vbCrLf)
ext:
End Sub