Nick
Nick

Reputation: 4766

stop vs2012 from cleaning solution before debugging

I need some dlls in the bin/Debug folder of my project for it to actually run but every time if I don't include those dll as references in the project then Visual Studio is just automatically deleting them when I try to debug. How do I stop it from doing that?

Upvotes: 1

Views: 1780

Answers (2)

Clark
Clark

Reputation: 488

I had this same problem. What I had was Project A -> Project B -> Project C, and Project C had the DLLs that were copying through (Build Action "Content" Copy Local Always) to Project A's bin debug. (-> indicates a reference)

However, when starting debugging, these would be deleted from Project A's bin/debug.

The Solution

Add a reference from Project A -> Project C

Upvotes: 0

Kate Gregory
Kate Gregory

Reputation: 18944

There are three ways you can deal with this. In order of preference, they are:

  • Teach Visual Studio how to build your debug release properly, including copying those files into that folder (a custom build step could do this, or you could add them to the project with a type of Content)
  • Don't rely on Visual Studio to build-and-launch your app for you. Browse to the bin/Debug folder, double-click the exe, and then in Visual Studio use Tools, Attach to Process to attach to it and debug as usual
  • Change your Visual Studio settings so it doesn't automatically build before debugging. (Tools, Options, Projects and Solutions, Build and Run, the On Run dropdown.) You'll have to remember to build (and possibly copy the files) every time you make a change.

In general only a "Clean" or a "Rebuild" deletes things, so be sure you're not accidentally doing that yourself before you start debugging. "Build" and "Rebuild" are different.

Upvotes: 2

Related Questions