Error HRESULT E_FAIL has been returned from a call to a COM visual studio

ASAD Ali 0 Reputation points
2024-02-08T12:47:23.1+00:00

I have a problem while creating the Asp.Net MVC project on visual studio 2022. Project is created with an error message.

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

Project is opened but unable to build, build failed and pop up appear with message.

Build failed, Do you want to continue debugging.

I have tried multiple mentioned solutions but failed to resolve the issue. Following are the solutions which I have tried but failed.

Solution 1:

  • Close the VS.
  • Delete the cash folder having name ProjectTemplatesCache and ComponentModelCache.
  • Reset the Visual Studio Setting. Tools>Import and export settings>reset all settings

Solution 2:

  • Close Visual Studio.
  • Go to the project's root folder and delete the .vs directory.
  • Start Visual Studio and open the solution.
  • The build should now work.

Solution 3:

  • Close Visual Studio.
  • Start —> Run —> regsvr32  %SystemRoot%\System32\msxml3.dll
  • Start —> Run —> regsvr32  %SystemRoot%\SysWOW64\msxml3.dll
  • Open Visual Studio Project, it will work.

Solution 4:

  • Close Visual Studio.
  • Uninstall the visual studio and all its temp folders.
  • Reboot the system.
  • Reinstall the visual studio.
  • Get same error, failed to resolve it.

Any solution Please, I have attached the error screenshots.

WhatsApp Image 2024-02-04 at 5.54.39 PM

WhatsApp Image 2024-02-04 at 5.54.38 PM

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,447 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Anna Xiu-MSFT 30,921 Reputation points Microsoft Vendor
    2024-02-09T04:05:30.13+00:00

    Hi @ASAD Ali, 

    Welcome to Microsoft Q&A! 

    Are you using the latest VS2022 version 17.8.6? Does it occur in other projects?

    I created different ASP.NET MVC projects (.NET and .NET Framework) on my side and it has no error. 

    You can check if the file (D:\...\bin\FirstWebProgram.dll) exists. And try to rename it.

    Then, go to Visual Studio Installer and repair the VS.

    When creating project, please try to save the project into another location.

    If you have any anti-virus or security management software, please temporarily disable them. 

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.      

    0 comments No comments

  2. ASAD Ali 0 Reputation points
    2024-02-22T06:13:31.32+00:00

    The issue has been resolved by downgrade my windows from windows 11 to windows 10. I have tried all possible solutions, like repair VS 2022, uninstall and then reinstall the VS 2022 but only the solution which I got is to downgrade the window, I don't know the why, but issue resolved. Thank everyone.


  3. Bryan Kelly 401 Reputation points
    2025-02-20T23:52:21.3733333+00:00

    Windows 11, VS Professional 2019, Version 16.11.44, C++, MFC

    I have been getting the same error but on project creation. First a dialog with: Cannot open file. No additional details. When OK is clicked the next dialog complains: Error HRESULT E_FILE has been returned from a call to a COM component.

    My thread is here: https://learn.microsoft.com/en-us/answers/questions/2157095/create-c-gui-project?comment=question#newest-question-comment

    This thread references VS 2022. Looks like that is the most recent version. Should I try that one? Any additional suggestions?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.