Visual Studio ,Configuration Properties->Debugging - visual-studio-2010

I run my program from some project ,using
"Configuration Properties -> Debugging"
When I press F5,before starting to run the program it compiles the project...I don`t want to compile the project,but just start execution of what I defined in the
"Configuration Properties -> Debugging".
(The program executable exists)
How can I do it?
Thanks

The option that controls this is not directly associated with a project; it is under the general Visual Studio options.
Choose the menu item Tools\Options. Then go to Projects and Solutions\Build and Run. There is an option named "On Run, when projects are out of date:. You can choose between "Always build", "Never build", "Prompt to build".

I am not familiar with build configuration, but if you want to debug a .exe that you built, you can start it and use Visual Studio's Attach to Process ( Tools -> Attach to Process) to bind yourself to that .exe and debug it.

Related

VS Debugging: Attach to a process that hasn't startet

In Visual Studio I can attach the debugger to any process that is currently running.
I have an application that is calling my DLLs and what I need is to debug this process from it's beginning. Is this possible?
Open the project properties (context menu, Properties or Alt+Enter)
Go to the Debug tab
Choose "Start external program"
Save and close
Choose debug mode
Run the application (F5)
If the application expects the DLL in a specific path, it may be necessary to add a post build step to copy the DLL to the expected location.

Visual Studio 2015 error when multiple debug: The process cannot access the file

I have 2 projects in solution (2 WPF apps: Client and Server). When i debug each project separately then everything is ok. When i debug both projects after build solution then ok again.
Error appears when i build solution, make change in code of Client project, then start debug only Server project and while debugging i start debug Client project. So when i start second debug Visual Studio shows me error "The process cannot access the file '\obj\Debug\Otb.Client.exe' because it is being used by another process.". Can i do this without error?
1) Open the "Tools" menu, and click "Options".
2) Expand "Projects and Solutions".
3) Click on "Build and Run" tab.
4) Uncheck "Only build startup projects and dependencies to Run"

Run console app in visual studio when file changes

Is there a way in visual studio (2015) that when a file is changed i can exec a console app and pass the updated file name as an argument into the console app?
Do you really want to run your tool every time when the file changes?
Would you compromise to run it as a part of your build? Then you can do it easily.
In the Properties of that file, General - change "Exclude From Build" to "No". On the same page, change "Item Type" to "Custom Build Tool".
The "Custom Build Tool" item will be added to your "Configuration Properties" tree. Click on "General".
Specify the "Command Line", something like:
notepad.exe %(FullPath)
Also specify the "Outputs", like:
$(OutDir)
If you really need to run your tool on every save, you'd need to write a Visual Studio extension, handle "save" notification and run your tool from there.
You can subscribe to the DTE.Events.DocumentSaved VS event and run your console app from it. For example, adjust the following Visual Commander extension: Run Cppcheck on the saved file.

How to add a pre-build step to project via the Visual Studio IDE

Is there an easy way to add a pre-build/post-build step to a project via the Visual Studio IDE? I know I can edit the .csproj/.*proj file - what I want to know is if there is a way right from the IDE.
You can right-clic on the project name in the solution explorer and clic on "properties" in the popup menu. In the window that shows up, go to the section "configuration properties / Buid events" (or something similar: my IDE is in french). You will then have the choice:
Pre-build events,
Pre-link events,
Post-build events.

Why doesn't F5 rebuild project before execution in Visual Studio?

If I press F5, my project runs but it doesn't "see" any of the changes that I made. I need to manually (re)build before pressing F5 for it to work.
It worked well previously. Any idea what I need to change?
Also :
Right Click on the solution in the solution explorer.
Click on "Properties".
Navigate to configuration Properties -> Configuration on the left side of the window.
Make sur the "Build" checkbox is checked on the line of your project.
Is it possible that you've reconfigured your "Build and Run" settings to "Never build"?
To check, follow these steps:
From the Visual Studio IDE, open the "Tools" menu, and click "Options".
Expand the "Projects and Solutions" header on the left.
Click the "Build and Run" item.
In the combo box labeled "On Run, when projects are out of date", ensure that you have the "Always build" option selected.
Another reason (which I had) could be dependencies.
In Solution Explorer, right click the Startup Project - Build Dependencies - Project Dependencies.
If the project you are working on is not set as a dependency of the Startup project then it won't get Built when you F5 / run.
Ok, for some reason all of the above solutions do not work for me, so I made a Pre-Build event (Right click project -> Properties -> Build Events) where I delete the bin and obj folder before building.
I am new to C# and Visual Studio but i found that going to Build -> Clean Project also worked for me, if you have already tried to select "Always build" option and it didn't work.

Resources