简体   繁体   中英

Pressing F5 in Visual Studio 2010 Builds but does not Launch Application

I have a Click Once application (WPF) in C#. Initially when I would hit F5 to debug/launch the application it worked smoothly. Eventually, F5 only would build the solution and not launch the application (therefore I could not step through my code). For a short while I switched from Debug to Release mode and for some reason that allowed the application to launch after using F5 and I could step through my code again. But now that no longer works either. Long story short, I cannot get the application to run in a manner that allows me to step through the code. I can only do a Start without Debugging (Ctrl + F5). Obviously this doesn't do much for me other than tell me if the application works or not.

今天对我有用的事情是打开任务管理器并查找任何未正确终止的调试程序。

Task Manager > Processes > kill all programs "*.vshost.exe *32"

I had this same issue today and came here looking for help. I tried all the suggestions here and nothing helped.

Seeing as my solution was a simple console application I recreated it from scratch. The new solution didn't exhibit the problems, so I started comparing the two.

I reset the solution and project files so that they were identical (apart from Project GUID, name and root namespace) but the first solution still didn't run.

I then tried deleting the suo files, and the bin and obj folders. Still the first solution wouldn't run.

Finally, I noticed the vshost.exe process was still running for the project. When I killed that and reloaded, it all started working correctly.

You probably have lost your start up project in the solution, or the start up project is messed up, and no correct "item" is defined for the startup.

Right click on one of your projects, and select : define as startup project. Then retry that should do the trick. If not, check in that projects properties to see if a form or something is defined as the startup object for that project.

Edit : Obviously dont define a class library project as startup project, but choose your UI :).

I just had this problem today. The solution turned out to be a slight twist on the issue with *.vshost.exe mentioned previously.

I could build the application just fine but msvs refused to launch it. I could manually launch the application and the time stamp on the file indicated that it was in fact a fresh build as well. *.vshost.exe wasn't showing up in the task manager, so I couldn't end the process as suggested.

When all else failed, I tried deleting the .exe's and found that *.vshost.exe would not delete because it was in use. The error message indicated that it was actually the steam client (third party software) that had somehow grabbed my *.vshost.exe file and was "using" it. Not sure how or why. At any rate, I completely shut down steam, then it let me delete *.vshost.exe. After that, building and running from msvc worked normally.

Had the same issue, eventually tried deleting all breakpoints and the debug started working again. Yet to figure out why, but at least it works.

As well as the ghost *.vshost.exe. It could also be that you have the same Solution/Project open in another version of VS. I had the same Solution open in both VS2010 and VS2015 and when running in VS2010 it compiled but failed to start. Closing the VS2015 Solution and it ran as expected.

After years of using VS 2008, I suddenly had the F5 problem not launching the application. There must be a dozen different suggestions out there - I tried a few. Someone suggested a virus. My Microsoft Security Essentials was not automatically updating (a common problem it seems), so I manually updated it. It found a virus, removed it, and the F5 problem went away !

Had this problem and tried to delete everything in bin/debug folder but could not delete vshost.exe file - kept requesting admin permission and then still could not remove it even though running from admin account. Restarted and file was gone and f5 worked again

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM