This is for Visual Studio 2008.
I have Tools|Projects and Solutions|Build and Run|On Run, when projects are out of date
set to Always build
bec
In VS2013 it is: right click solution -> Configuration Manager
, and clear Build checkbox of your project(s).
No, there isn't. You can't debug an historic version without running it, which implies building it. VS debugs against the current symbols and binary, which will be out sync with the source without building it, making debugging impossible.
I found it convenient to create a new build configuration in order to do this.
Right-click the solution in the Solution Explorer and choose Properties
. From there, choose Configuration Properties / Configuration
. Now choose Configuration Manager
and create a new configuration as shown. You can create the build configuration as a copy of your Debug project:
Then, press OK
and turn off all of the project build flags:
Visual Studio will have created a folder underneath the bin
folder in the startup project with the name of the new configuration. Copy your pre-built files into there and run the new configuration.
I put the following function in my NuGet_profile.ps1
:
function debugnobuild() {
# temporarily disable build (same as Properties -> Configuration -> ..)
$buildProjects = @($DTE.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts |
where ShouldBuild | foreach {
$_.ShouldBuild = $false
$_.ProjectName
})
try {
# start debugging
$DTE.Solution.SolutionBuild.Debug()
}
finally {
# undo changes
$DTE.Solution.SolutionBuild.ActiveConfiguration.SolutionContexts |
where { $buildProjects -contains $_.ProjectName } | foreach {
$_.ShouldBuild = $true
}
}
}
Then just call debugnobuild
(or any name you prefer) in the Package Manager Console.
What I do is: Set a System.Diagnostics.Debugger.Launch()
line in the code, run the program seperately, attach the debugger in VS.
Please right click solution name and go to Properties -> Configuration Properties -> Configuration
, clear the Build checkbox of the project.