Access denied error when building solution in Visual Studio 2005 - c#

I get the following error in Visual Studio 2005 when doing a build:
Error 9 Cannot register assembly
"E:\CSharp\project\Some.Assembly.dll"
- access denied. Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED)) project
It happens only intermittantly and does go away if I restart the IDE, however this is incredibly annoying and I would like to put a stop to it happening permanently, if I can. I've checked the assembly itself, and it is not set to read only, so I've no idea why Visul Studio is getting a lock on it. I am working in Debug mode.
I've had a look around google, but can't seem to find anything other than "restart VS". Does anyone have any suggestions as to how I can resolve this annoying problem?

It sounds like you have a DLL that gets locked every now and then, preventing VS from overwriting/locking it. Have you tried using tools like Process Explorer (http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx), or Unlocker (http://www.emptyloop.com/unlocker/) to see what is locking the DLL? Unlocker in particular has saved me many a time.
As noted in the comments below (Thanks Jeff), you can also kill an individual lock from within Process Explorer.

This may be caused by Visual Studio requiring administrator rights on Windows 7 or higher. To check, see whether the registry key mentioned below is set. If not, copy into a .reg and merge. Be sure to check that your Visual Studio 2005 installation path in the .reg file is correct!
Windows Registry Editor Version 5.00
; Run Visual Studio 2005 with administrator rights
; This is required to run / debug the program directly from the IDE
[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers]
"C:\\Program Files (x86)\\Microsoft Visual Studio 8\\Common7\\IDE\\devenv.exe"="~ RUNASADMIN"

Related

when build solution its give error access denied

the last access/last write time on file cannot be set. access to the path is denied I try to set the bin folder for unchecked as a read-only file and folder but no luck
It sees there are some problems with your Visual Studio. You can try to reinstall or update the Visual studio.
There is a same issue in the visual studio community which is resolved by downloading the higher version of VS.
You can check it:https://developercommunity.visualstudio.com/t/the-last-accesslast-write-time-on-file-xxx-cannot/520031

How can I fix this visual studio error? "The requested operation cannot be performed on a file with a user-mapped section open"

I am getting this error for various DLL's which are outputs of projects in my solution.
Things I have tried:
Restarting PC multiple times
Closing visual studio
Turning off all visual studio extensions
Deleting the files manually in the explorer. I get the error "The action can't be completed because the file is open in another program"
Using ProcessExplorer to find processes that are using the DLL's. It does not find any processes
I have tried using ResourceMonitor and WhoLockMe as well, to no avail
I have killed the explorer.exe process and that didn't work either
From command line I ran 'git reset --hard HEAD' to revert to the last commit (which was a stable build)
Any other ideas how I might be able to unlock these files?
Update: Turns out that some of the DLL's in every solution that I opened with Visual Studio yesterday are permanently locked
I do not have Visual Studio Achievments installed and I have disabled all extensions. Closing open documents did not help.
Somehow the issue solved itself after I did the following:
Clone the project into a different folder
Build and run the cloned project with Visual Studio
A few hours of programming later I tried to delete the files and they were no longer locked

Getting visual studio error An exception occurred while invoking executor 'executor://mstestadapter/v1': Could not find a part of the path 'C:\'

I am getting error upon executing debug test on my visual studio as following code.
Getting visual studio error An exception occurred while invoking executor 'executor://mstestadapter/v1': Could not find a part of the path 'C:\'.
I have used different computer and it works fine. Its only my computer is showing above error. I have also installed fresh copy of Visual community.
Does anyone have similar issue before? How to resolve this?
Such problems can be a real hard-brainer so lets try to collect all pieces before going deeper.
I guess you do not really try to access some files directly on "C:\", am i right?
Can you give us some code?
Are you using the [DeploymentItem] attribute (right)?
Do you have the right write privileges onto the directory you are trying to access?
Are you targeting the right version of the "Microsoft.VisualStudio.QualityTools.UnitTestFramework". Compare the string you are using in the App.config with the version displayed in the propoerties windows when inspecting the according reference in your solution.
Try to run the following command from the console in your debug directory:
"PATHTOVSTEST\vstools.console.exe" yourtest.dll you.exe
I've found the executable here:
C:\Program Files (x86)\Microsoft Visual Studio
14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\
Let us know if anything of the suggested things got you closer to a solution.

VS Crashing after 'Set As StartUp Project'

I have a solution in VS 2012,
I try to change the startup project to specific project but the vs crashing immediately (with the other projects - no problem)
with the familiar message "Visual Studion Stop Working.."
I try also to define the startup project manualy in the .suo file
(See details in Why is "Set as Startup" option stored in the suo file and not the sln file?)
But when i reopen the VS, it crashes during the assemblies loading.
Any idea what can be the cause?
Edit:
Additional Details:
Its solution contains also WCF project, run in front of local IIS, This project run perfectly, with the same code, in other team computers.
As result of the facts, It seems an environment problem, IIS setting, Permissions and etc.
Note that i already reset VS setting, and also repair the installation and the problem not resolved.
Maybe someone knows what the logical action of 'Set as startup project', what the VS perform during the action except for the start point definition? i think that the root of the problem hides there...
I had this problem too, but on VS 2015. You should logoff from your MS account from VS, set your project as startup and then login back if you want ...
It is hard to guess what the problem could be, but because it works on other team members' machine, it might have something to do with your Visual Studio state.
Try clearing or moving out all files from:
C:\Users\<Username>\AppData\Local\Microsoft\VisualStudio (if starting as admin)
C:\Users\<Username>\AppData\Roaming\Microsoft\VisualStudio (if not starting as admin)
You might need to restart your machine if the files are in use before you can delete/move them. These folders contain some VS settings, cached files and logs.
In addition to what AVS said, you can try deleting your Visual Studio .suo file.

Program.vshost.exe Error Preventing Running Program

I've been moving files around from my debug folder in an attempt to open the executable for my program from a different location. This seemed to have screwed things up, and I'd like to know how to fix them.
The exact error reads as follows:
"Visual Studio could not copy a support file to this location:\Program.vshost.exe'. Please verify the path exists and is writeable."
And ideas on how to fix this?
Right click on the project/solution -> Properties -> Debug -> Uncheck "Enable visual studio hosting process"
Also you can terminate it from Task Manager. if running Win 6 or 7 use end process from admin previlige

Categories