10

I am making a desktop application in windows forms and i dont know why appear the error:

“Error HRESULT E_FAIL has been returned from a call to a COM component”

On the designer of all my user controls and windows.

I know that are others threads with this problem but i checked them and i didnt get a solution.

I tried deleting ProjectTemplateCache and clearing the build and rebuild but it doesnt work. I read that i can delete .suo and .user files but in my project folder doesnt exists that fields. I am using Visual Studio 2015.

Someone knows how to fix it?

Patricio Diaz
  • 127
  • 1
  • 1
  • 5
  • 9
    Check your project references to see if the project references itself. See: [Error HRESULT E_FAIL has been returned from a call to a COM component. - by WannaFly37t](https://connect.microsoft.com/VisualStudio/feedback/details/2013884/error-hresult-e-fail-has-been-returned-from-a-call-to-a-com-component) – TnTinMn Aug 23 '16 at 04:23
  • 3
    the project have a reference to itself – Patricio Diaz Aug 23 '16 at 16:21
  • 4
    `"the project have a reference to itself" - then delete that reference. Hopefully that will fix that issue. – TnTinMn Aug 23 '16 at 16:56
  • it works, thanks TnTinMn – Patricio Diaz Aug 23 '16 at 17:50
  • I can Confirm this was the issue in my multi-layer application. – Niklas Jul 16 '17 at 10:46
  • 1
    @TnTinMn thank you I was also having exactly the same problem : an assembly referencing an old compiled version of itself located in a random directory of C:\Temp. Strange and dumb – AFract Aug 31 '17 at 15:01

1 Answers1

7

Also had this problem.

As said in the comments, the solution was to track down a reference to the project itself and get rid of it - there's no sense behind it.

It was a bit tricky to find it first since the reference name changed meanwhile and was not the same as the project anymore, so make sure to keep that in mind.

Ray
  • 7,940
  • 7
  • 58
  • 90
  • 1
    Removing reference (and project name changed) along with unchecking "Allow parallel project initialization". is what fixed it for me also. Design view worked in VS 2013, but not 2015. Things that also may have contributed: Upgrade to Ver 15.5.3 (the previous one was 15.5) didn't help, but it allowed me to do Tools -> Options->Projects and Solutions-> General-> uncheck Allow parallel project initialization. That plus removing the reference fixed. – SeraM Jan 11 '18 at 20:05
  • If you get rid of the HRESULT EFAIL message, and get a compiler warning "Unable to apply publish properties for item X", you may need to remove the reference from Publish/Application Files. See [Unable to apply publish properties answer](https://stackoverflow.com/a/35358044) for more details. – SeraM Jan 12 '18 at 15:18