In Visual Studio 2019 Update 16.5 or later you can go to Tools > Options > Projects and Solutions > Build and Run and set 'On Run, when build or deployment error occurs' to one of the options below. Once this is set, running and debugging tests will honor this option as well.
The reason Visual Studio cannot find the exe is because it didn't create one. Your project does not include any source files (observed by the empty "Source Files" folder under the Project2 node in the Solution Explorer window).
Build and run your code in Visual Studio To build your project, choose Build Solution from the Build menu. The Output window shows the results of the build process. To run the code, on the menu bar, choose Debug, Start without debugging. A console window opens and then runs your app.
Tools + Options, Projects and Solutions, Build and Run. "On Run, when projects are out of date" = Always build. The one below that = Do not launch.
I had this problem and it turned out to be the Configuration Manager. I had recently changed from Debug|Mixed CPU to Debug|Any CPU and the project wasn't set to build under this configuration
open your configuration manager and check out if the checkbox in the build column for your startup project is checked. I had the same problem, but the checkbox wasn't active, so i checked it and now it works!
Apart from the above also make sure that 'Only build startup projects and dependencies on run' is unchecked (in Tools-->Options-->Projects and Solutions-->Build and Run)
I had this problem too. I checked everything suggested to no avail. It turns out my clock on my pc had gotten set forward by about 12 hours, and I was saving to a network drive. The timestamps of the files were out of wack, and VS didn't think it needed to build my project because the files were super up to date.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With