Unable to copy file - access to the path is denied

后端 未结 30 1124
死守一世寂寞
死守一世寂寞 2020-11-30 19:05

I am using Visual Studio 2005. After taking code from version control first, the c#.net application runs correctly. But, after doing some modifications, when I build I am

相关标签:
30条回答
  • 2020-11-30 19:59

    You aren't supposed to change the folder attribute to not-readonly. The reason you are seeing this error message is that source control assumes that you only store your miscellaneous files somewhere other than bin folder, for it it reserved for files that are automatically created by .Net and it doesn't want to add them to source control.

    I suggest instead of using Environment.CurrectDirectory (which I assume you are using currently), you create a folder named "MyProjectName" in %appdata% address and then use:

    System.IO.Path.Combine(Environment.GetEnvironmentVariable("appdata"),"YourProjectName").

    0 讨论(0)
  • 2020-11-30 20:00

    Just make sure that the folder is NOT Read-Only and rebuild the solution

    0 讨论(0)
  • 2020-11-30 20:00

    I also had this issue. Here's how is resolved this

    • Exclude bin folder from project.
    • Close visual studio.
    • Disk cleanup of C drive.
    • Re-open project in visual studio.
    • And then rebuild solution.
    • Run project.

    This process is works for me.

    0 讨论(0)
  • 2020-11-30 20:02

    Run your Visual Studio as Administrator

    0 讨论(0)
  • 2020-11-30 20:03

    In my case it was the antivirus which blocked the file.

    0 讨论(0)
  • 2020-11-30 20:03

    I had the same issue, To resolved this i had checked/done several things

    What Didn't work

    1) Read/write permissions were given to directory 
    2) Restarted visual studio
    3) Tried deleting visual studio temp files
    

    What worked at last

    Just paste the command given by Fred Morrison into the "Package Manager Console":

    Get-Process | Where-Object -Property Name -EQ 'VBCSCompiler' | Stop-Process -Force -Verbose
    

    Note: Just an observation Restarting Visual studio might not work in this case but restarting system can because stoppin process "VBCSCompiler" was the solution so we can do it either way.

    0 讨论(0)
提交回复
热议问题