none
Problems with VSHOST.EXE RRS feed

  • Question

  • Hi all,

    I've started getting errors when building an application.  It stop building with an "This operation could not be completed" error.  If I try again, it then says "Visual Studio could not copy a support file to this location <path to VSHOST.EXE>".

    I can fix the error by renaming VSHOST.EXE to VSHOST.EXE.OLD and rebuilding. 

    The project is on a network share so perhaps this could be the problem
    Monday, April 24, 2006 1:19 PM

Answers

  •  

    There are two things happening here.

    1. When you start debugging (I'm assuming you're actually starting a debugging session with F5 (or from the menu) and not building the project), Visual Studio checks the version of the projectname.vshost.exe file in your output directory.

    If the projectname.vshost.exe file in your output directory is different (by binary comparison) to the vshost.exe located at c:\program files\microsoft visual studio 8\common7\ide\vshost.exe AND the file in the install directory has a newer file date/time, Visual Studio will attempt to copy this file to your output directory to make sure you have hte latest version in your output directory.

    Since it appears that we're trying to copy the file, it appears that both these conditions are true (unless there is a bug). Once VS copies vshost.exe from the install directory to your output directory, it should never have to do it again because subsequent binary comparisons of the file will show they are the same - unless there is something else that is replacing the file (maybe an beta version of VS?)

    2. There seems to be something preventing the copy from succeeding. There is an open file handle to the vshost.exe file in your output directory. Something still has the file locked (in use) and so VS is unable to copy over the file. Are there extra vshost.exe processes running on your machine? Are you running more than one instance of VS with the same project open? These are usually the cause for the file to be locked in use when we cannot replace the file.

    -- Michael Eng

    -- Visual Studio Project Team

    Wednesday, May 3, 2006 11:39 PM

All replies

  • Any ideas on this error please?
    Tuesday, April 25, 2006 12:48 PM
  •  

    There are two things happening here.

    1. When you start debugging (I'm assuming you're actually starting a debugging session with F5 (or from the menu) and not building the project), Visual Studio checks the version of the projectname.vshost.exe file in your output directory.

    If the projectname.vshost.exe file in your output directory is different (by binary comparison) to the vshost.exe located at c:\program files\microsoft visual studio 8\common7\ide\vshost.exe AND the file in the install directory has a newer file date/time, Visual Studio will attempt to copy this file to your output directory to make sure you have hte latest version in your output directory.

    Since it appears that we're trying to copy the file, it appears that both these conditions are true (unless there is a bug). Once VS copies vshost.exe from the install directory to your output directory, it should never have to do it again because subsequent binary comparisons of the file will show they are the same - unless there is something else that is replacing the file (maybe an beta version of VS?)

    2. There seems to be something preventing the copy from succeeding. There is an open file handle to the vshost.exe file in your output directory. Something still has the file locked (in use) and so VS is unable to copy over the file. Are there extra vshost.exe processes running on your machine? Are you running more than one instance of VS with the same project open? These are usually the cause for the file to be locked in use when we cannot replace the file.

    -- Michael Eng

    -- Visual Studio Project Team

    Wednesday, May 3, 2006 11:39 PM
  • Hi Michael,

    I've run into this problem a number of times and it was caused by the debugger not stopping/killing the execution of vshost.exe that is running during the debugging session.  This could be something in the user's/my code that might cause this, but if I click on "stop debugging", it doesn't always clean up vshost.  I'm much more successful (perhaps all the time?) if I do a "terminate all"; I'll pay more attention over the next few days, as I've gotten in the habit of using "Terminate All" over the last few weeks, just because of this problem.

    Thanks, Tom

    Saturday, August 12, 2006 6:56 AM
  • I got this problem because I was writing to the event log, but I forgot to call eventLog.Close().
    Tuesday, October 3, 2006 2:22 PM
  • Hello

    I get the same thing. Has anyone given a good explanation or work around?

    Wednesday, October 18, 2006 4:04 PM
  • I'm getting this problem too. After a bit of experimenting with "hello world" programs I have found the following factors are involved:

     

    1. It does NOT happen with Visual C# Express, but it does happen with C# programs in Visual Studio 2005 (Visual Studio Tools for Office in my case)

    2. The project is checked out from CVS (I am using a CVSNT server and a WinCVS client)

    3. The project has at least one 'Setting' in the project properties.

     

    Given these conditions, the steps to reproduce are:

     

    1. Open the project/solution

    2. Run the program in debug mode

    3. Exit the program

    4. Look in Windows Task Manager - there is still a [project].vshost.exe running (and it can't be terminated)

    5. Make a change to a project setting

    6. Try to run the program in debug mode again - This produces the "this operation could be completed" error

     

    If I then exit and restart Visual Studio, I can then run the program without error.

    Tuesday, May 29, 2007 10:45 PM
  • I have this problem when I start VS2005 and then start a project (in debugging mode). But if I delete all vshost files in the ...bin/debug folder when VS2005 is not running, I don't get the error. I am not sure where to tell the IDE to release the lock. Any ideas?

    Friday, March 21, 2008 10:29 PM
  • Since the "*.vshost.exe" and "*.vshost.exe.config" files are only for use in the Visual Studio 2008 IDE. They should never be run directly. I made one change to run the application first I renamed the Application.vshost.exe after that it’s allowed me to run and debug the solution.

     

     

    Second solution:

     

    2. The issue can be resolved by unchecking the "Enable the Visual Studio hosting process" in the project properties, then rebuild the project and then re-enabling the VS hosting process and rebuilding the project.

     

    Project Properties->Debug-> uncheck "Enable the Visual Studio hosting process"

     

     

    I would suggest use first solution to resolve the problem.

     

    • Proposed as answer by Technosachin Tuesday, March 31, 2009 2:57 PM
    Tuesday, March 31, 2009 2:56 PM
  • I see the same issue even though the output directory vshost.exe is identical to the one residing in c:\program files\microsoft visual studio 8\common7\ide, both by binary comparison and date modified. Manually killing the vshost process alleviates the problem (in fact, I added this as a custom pre-build step workaround). It does seem to be necessary to run from a network share to reproduce the problem. Anyone figure this out yet?


    Tuesday, June 16, 2009 6:17 PM
  • I too encounter this problem. My H:\Visual Studio 2008\Projects\Project\Project\bin\Debug directory is under my home drive, which is mapped to a network share (backup, doncha know)...
    I have to close VS, delete Project.vshost.exe, restart VS, and run my debug session. It seems unwieldy, having to close VS to delete the file (because it is locked by VS)...
    Surely by now we can build an IDE that works without this kind of gymnastics!!! Surely by now we can build a wiki page with intuitive features, or one that accepts html tags!!!
    • Edited by 0xG Friday, June 19, 2009 3:45 PM
    Friday, June 19, 2009 3:41 PM
  • Here is a post on What is the vshost.exe file? and how to disable the creation of vshost.exe file.

    http://dotnetrobert.com/?q=node/25

    Hope that helps
    Saturday, March 6, 2010 11:33 PM
  • I am getting the error by removing an image from a picturebox:

                Do Until PictureBoxIdle.Image Is Nothing
                    PictureBoxIdle.Image = Nothing
                    System.Windows.Forms.Application.DoEvents()
                Loop

    and then trying to delete the image file that was previously displayed in the picturebox using the following code:

                Try
                    My.Computer.FileSystem.DeleteFile(current_idle_image_file, Microsoft.VisualBasic.FileIO.UIOption.AllDialogs, Microsoft.VisualBasic.FileIO.RecycleOption.SendToRecycleBin)
                    MsgBox("The file has been sent to the recycle bin", vbInformation)
                Catch ex As Exception
                    MsgBox("An exception occurred trying to delete the selected file", vbExclamation, "File Not Deleted")
                End Try

    Error message:

    The action can't be completed because the file is open in vshost32.exe

    Close the file and try again


    RONATMOODYLAKE

    Monday, March 31, 2014 5:23 PM
  • Right click on the project/solution -> Properties -> Debug -> Uncheck "Enable visual studio hosting process"

    I think this will help you..

    • Edited by Jithin1991 Tuesday, May 31, 2016 9:34 AM
    Tuesday, May 31, 2016 9:33 AM