Error HRESULT E_FAIL has been returned from a call to a COM visual studio while creating a file (vs 2022)

Rin 0 Reputation points
2024-08-20T06:55:54+00:00

Hello I need your help with this problem of mine, when I try to create a new project in Visual Studio from ASP.NET Web Application (.NET Framework) >> MVC >> Create it will show the error "error hresult e_fail has been returned from a call to a com component"

I tried reinstalling the IDE, and I had the same problem. Restarted my computer. I tried deleting the .vs folder, but I had the same problem. Double checked the file location for the downloaded cache (I don't know if this will matter?)

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

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 30,356 Reputation points Microsoft Vendor
    2024-08-21T06:10:16.14+00:00

    Hello @Rin,

    Welcome to Microsoft Q&A forum.

    May I first confirm following things:

    1. If you try to create another type of project, for example, a simple C# console app, will the same error appear?
    2. Does this error appear on .NET(like .NET 8) projects?
    3. If you change to target other versions of .NET Framework(like 4.7.2, 4.8), will the error appear?

    As you have reinstalled the IDE but the error persists, I think this issue may be not caused by VS, but by cache, system environment, frameworks or some configurations. Try following:

    1. Run Visual Studio as administrator and create an ASP.NET Web application, but this time save it into another short, empty directory(like C:\MyProjects), see if this works.
    2. Rename following folders => C:\Users\username\AppData\Local\Microsoft\VisualStudio\17.0_xxxxxxxx\ComponentModelCache, %Temp%(you may need to reboot your machine and then rename the Temp folder).
    3. Update Windows OS.
    4. Open CMD as administrator, run DISM.exe /Online /Cleanup-image /Restorehealth, after it finishes running, run sfc /scannow.
    5. If you modified any Windows Registry keys, changed any system environment variables, customized any system settings, removed some system files, please try to recover them and test again.
    6. If there’s any limitation(like permission limitation, antivirus, security management software, group policy…) on your machine, try to double check and confirm that they won’t block VS from creating related ASP.NET Web application files.
    7. Try to manually download and install newer or other versions of .NET Framework, see if this works.

    Feel free to let us know the results :)

    Best Regards,

    Tianyu


    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.


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.