none
access denied RRS feed

  • Question

  • I've been working on a Crawler for a few days now and its suddenly decided to refuse 'access to path'.  

    Severity Code Description Project File Line Suppression State
    Error CS2012 Cannot open 'C:\C#\Crawler\obj\Debug\Crawler.exe' for writing -- 'Access to the path 'C:\C#\Crawler\obj\Debug\Crawler.exe' is denied.' Crawler C:\C#\Crawler\CSC 1 Active

    I recognise this is not really a C# problem but I don't know why it was working before and now it suddenly has a problem.

    how do i fix this?

    Christ


    my code is perfect until i don't find a bug


    Wednesday, August 21, 2019 1:42 PM

All replies

  • Hi,

    I understand this is a compiler error. Are you running the application in the background while trying to compile it?

    Look at your Task Manager and kill (close) all running instances of your application (Crawler.exe) before compiling your code from Visual Studio.

    Kind regards,

    Johnny Hooyberghs

    Wednesday, August 21, 2019 1:50 PM
  • Hello,

    Try the following.

    Close Visual Studio, delete from the project folder the obj and Bin folders. Open the project back up and do a build, Sometimes Visual Studio will not release a lock until closed.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, August 21, 2019 2:13 PM
    Moderator
  • thanks for replying,

    not only does the task manager show me that I am not running the app in the background but the file in question does not exist.  I just deleted the entire obj directory and tried again.   same problem.

    Christ


    my code is perfect until i don't find a bug

    Wednesday, August 21, 2019 2:57 PM
  • ok.

    I closed Visual Studio.  Deleted both the Crawler project's Bin & Obj subdiretories and tried again.

    same issue.  that didn't fix it.  I'll try moving everything to another directory but that seems like a lateral move.

    Christ


    my code is perfect until i don't find a bug

    Wednesday, August 21, 2019 3:02 PM
  • Have you tried running VS with admin rights, if UAC is enabled?
    Wednesday, August 21, 2019 5:29 PM
  • Hello,

    Reboot your computer, don't run anything except Visual Studio. If this fails the try downloading Process Monitor  then press the button in step 1, press the button in step 2. Then right before building in Visual Studio press step 1 button, once the error is reported press step 1 again. See if anything reports holding a lock to the executable being built.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, August 21, 2019 5:37 PM
    Moderator
  • Hi Christ Kennedy,

    Thank you for posting here.

    For your question, I have two suggestions.

    First, I suggest that you could use administrator privileges to execute this file.

    Second, I recommend that you could move your related folder to D drive.

    Please check these two suggestions to see if it works.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 22, 2019 1:52 AM
    Moderator