locked
"Windows cannot access the specified device, path, or file.

    Question

  • Hello,
    I'm new to using the C# Express Visual Studio program and need some help.
    I've created a winform and defined methods to handle some controls.  The windows forms shows fine on my XP machine so as an experiment I copied the executalbe file from the ...bin/debug/ folder to 2 different XP machines to see I could run the program on the other machines.  Each of these other machines has the .NET 3.5 Bootstrap program installed on it.
    On Machine 1 the program, Name1.exe executed OK with the window openning up and most controls working fine.
    On Machine 2 the proram, Name1.exe gives the following message:

    "Windows cannot access the specified device, path, or file. You must not have the appropriate permissions to access the item."

    Any idea what would cause this or how to fix it?

    It's very confusing to me because .NET 3.5 is installed on both machines so I thought it would work.

    Monday, May 19, 2008 2:51 PM

Answers

  • Hi, Phil,

     

    Based on your detail description, I think your Windows Form application met some problem (showing an error) when running on some different PC, while it did work well in another one.  Be free to correct me, if there is any misunderstanding here.

     

    According to your description and testing, I don’t think there is anything wrong using e-mail to send the executable file to another computer either.  Actually, I think the error may be caused by some file permission problem, some remote file the application cannot access or other software closed the running door of your application.

     

    Did your application use any source from remote files or dll through network?  Or is there any software like anti-virus, firewall or spyware on the Machine 2 (the computer displayed the error message), which keep your application from running normally? 

     

    For the anti-virus software, I suggest you to turn the anti-virus software off or restart your Windows into Safe Mode (Restart your computer -> Press “F8” before Windows startup -> Choose “Safe Mode”), to avoid such kind of software’s interference.  Then run the application again to see the effect.   Hope it works.

     

    Important to mention, the release version of your application can be created by:

    Right Click your project’s name -> Properties -> Debug tab -> Change configuration to “Release” -> Save the properties -> Rebuild your project again (In Build menu).  Then a release version will be created in …bin\Release\...

     

    Hope I can help.  Please let me know, if you have any more questions.

     

    Thanks,

     

    Best Regards,

     

    Lingzhi

     

    Wednesday, May 21, 2008 5:44 AM

All replies

  • The C# Express Visual Studio I'm using is the 2008 version. 
    Monday, May 19, 2008 3:02 PM
  • Two thoughts for you.  First, If you are using the version from Debug, I'm not entirely certain that this will work on a non-development system.  Building the release may work better.  The other possibility is that if you are running the file from a network path, the .Net interpreter's security may not be allowing execution from that environment.  If you try moving the file locally, then it may start working.

    Monday, May 19, 2008 3:37 PM
  •  

    AJ, thanks for the initial comments.  The executable from the "bin/debug" folder actually does work.  I'm working with 3 PCs as defined here:

     

    1) DevMachine = Development Machine where C# Express Visual Studio 2008 is installed and the code is "built".

     

    2) Machine1 = An XP machine connected to the DevMachine via a network.  In this case I copied the Name1.exe file from the DevMachine location ...\bin\debug\.  The Name1.exe program runs OK on this Machine1.  The Name1.exe file is double clicked to execute it.

     

    3) Machine2 = An XP machine at a co-developers house in another state.  So in this case I had to email the Name1.exe file to the person using Machine2.  Machine2 is where the program gives the "Windows cannot access....." message.

    I used Outlook to email the Name1.exe file.  Since Outlook doesn't like executable files I removed the ".exe" extension from the Name1.exe file and just sent the file as "Name1".  The extension is then put back on at Machine2, then double clicked to execute it.

     

    Let me know if this clarifies anything?

     

    Also when you say "Building the release may be better." do mean the simple "Build" or a full fledged release build?  I've never done a full release build yet since I'm just starting but the simple "F6" type build I do all the time.

    Monday, May 19, 2008 6:54 PM
  • My last reply might have been mis-interpreted.  The executable we have does Not work on Machine 2.

     

    With regard to my concern about emailing the file using outlook I did an experiment.  I emailed the Name1.exe file from the DevMachine to Machine1 as a test.  I emailed the file without the ".exe" extension so just calling it Name1.1.  At Machine1 I saved it to the hard drive, put the ".exe" extension back onto the file so now it's back to Name1.exe, double clicked it and it executes OK, no problem.

     

    This same process was used for sending the file to Machine2 but it will not execute on Machine2 when double clicking it.

    Tuesday, May 20, 2008 1:29 PM
  • Hi, Phil,

     

    Based on your detail description, I think your Windows Form application met some problem (showing an error) when running on some different PC, while it did work well in another one.  Be free to correct me, if there is any misunderstanding here.

     

    According to your description and testing, I don’t think there is anything wrong using e-mail to send the executable file to another computer either.  Actually, I think the error may be caused by some file permission problem, some remote file the application cannot access or other software closed the running door of your application.

     

    Did your application use any source from remote files or dll through network?  Or is there any software like anti-virus, firewall or spyware on the Machine 2 (the computer displayed the error message), which keep your application from running normally? 

     

    For the anti-virus software, I suggest you to turn the anti-virus software off or restart your Windows into Safe Mode (Restart your computer -> Press “F8” before Windows startup -> Choose “Safe Mode”), to avoid such kind of software’s interference.  Then run the application again to see the effect.   Hope it works.

     

    Important to mention, the release version of your application can be created by:

    Right Click your project’s name -> Properties -> Debug tab -> Change configuration to “Release” -> Save the properties -> Rebuild your project again (In Build menu).  Then a release version will be created in …bin\Release\...

     

    Hope I can help.  Please let me know, if you have any more questions.

     

    Thanks,

     

    Best Regards,

     

    Lingzhi

     

    Wednesday, May 21, 2008 5:44 AM
  • Hi Lingzhi,

    Thank you very much.  It ended up being like you suggested......We believe it was either an anti'virus program or firewall on machine 2 that blocked the Name1.exe file from being executed.  When my Machine2 developer looked at the properties of the Name1.exe file he noticed a new button was shown on the General tab of the properties.  This button said the file was blocked due to coming from another machine.  By pressing the button the file became on blocked and ran perfectly.

     

    Thanks again for the great suggestions.

     

     

    Thursday, May 22, 2008 3:25 AM
  • The Attachment Manager blocks files from untrusted sources such as Windows Live Messenger contacts or email. 
    MSMVP VC++
    Wednesday, June 04, 2008 6:48 PM
  • I had a similar experience. Long Path Tool helped me me out. http://PathTooDeep.com
    Tuesday, October 02, 2012 4:00 AM