Jeremy Thompson
Jeremy Thompson

Reputation: 65554

Error while trying to run project: Access is denied

Trying to Start a Winform solution With Debugging in Visual Studio 2017 causes this error:

Error while trying to run project: Access is denied.

enter image description here

Running Without Debugging works and starts the project without the error.

enter image description here

This guy reported the same issue with a WPF project to Microsoft Developer Community (beta testing) but there is no solution: https://developercommunity.visualstudio.com/content/problem/39737/error-while-trying-to-run-project-unable-to-start-3.html

A ProcessMonitor Trace reveals its an Access Denied in the Registry:

39:45.7
devenv.exe
RegCreateKey    \REGISTRY\A\{3883977B-E889-4804-9494-B5A8BC8E3F1D}\Software\Microsoft\VisualStudio\15.0_8708a912\DialogPage
ACCESS DENIED
Desired Access: Maximum Allowed

Since its an Application Hive Registry Key it cannot be changed in RegEdit. UPDATE: You can change this, see my updated answer.

How can I debug projects?

Note: Answering my own question to help others in the future.

Upvotes: 3

Views: 18354

Answers (5)

samy nathan
samy nathan

Reputation: 91

Go to project property change the target framework version and try it once for me it worked.

Upvotes: 2

Vignesh S
Vignesh S

Reputation: 1

Delete the item that you have recently added in your project file.then run the program

Upvotes: -2

xparth
xparth

Reputation: 1

Try changing the Application Type in project properties to Console Application. When the application type is Windows Forms app, your antivirus might think you are trying to run a malicious content.

Upvotes: -3

Darrel Vinson
Darrel Vinson

Reputation: 1

I had this extremely annoying problem for a couple weeks and I would keep rebuilding my project and copying over the vb code and design code to do a crappy work around.

Today I finally found the root cause of my problem!!!!!

I have a resource folder with images including some of my icon images

In my forms i reference these images from my resource folder

In some rare cases instead of referencing my project resource file i would import from local and select the same image from my local drive with THE SAME NAME.

Apparently it confused the builder and i was able to get my project back operational by deleting the .ico image that was under each form on the solution explorer tree that had imported image files from local and referencing the images from my resource folder​ instead

Upvotes: 0

Jeremy Thompson
Jeremy Thompson

Reputation: 65554

Right click on the Winform or WPF Project > Properties > Debug tab > tick Enable native code debugging.

enter image description here

UPDATE: Use this answer to fix the Registry A Hive in VS2017 (it has its own registry):

https://stackoverflow.com/a/45579640/495455

Upvotes: 12

Related Questions