# Cannot generate project files after adding C++ to a blueprint project: Error while enumerating Visual Studio toolchains

**URL:** <https://forums.unrealengine.com/t/cannot-generate-project-files-after-adding-c-to-a-blueprint-project-error-while-enumerating-visual-studio-toolchains/744469>\
**Category:** International\
**Tags:** build-project-files, unreal-engine\
**Created:** [January 8, 2023, 12:22am UTC](https://forums.unrealengine.com/t/cannot-generate-project-files-after-adding-c-to-a-blueprint-project-error-while-enumerating-visual-studio-toolchains/744469 "2023-01-08T00:22:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fprebeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fprebeg](https://forums.unrealengine.com/u/fprebeg)\
**Post date:** [January 8, 2023, 12:22am UTC](https://forums.unrealengine.com/t/cannot-generate-project-files-after-adding-c-to-a-blueprint-project-error-while-enumerating-visual-studio-toolchains/744469/1 "2023-01-08T00:22:46Z")

</div>

I have installed binary 5.1 version from launcher. Created a blueprint project and it runs fine. I’ve added a C++ file and it failed to generate project files, and it keeps failing for some reason. I cannot even get the sln file… nothing. It fails from the very start.

I’ve switched from vs2019 to VS2022 and installed all workloads and components as stated in the documentation.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/3/d/53d04e89b429ae83ad259c7f7b2d3cf3ff3faef0.png)

It keeps throwing this error:

```auto
Discovering modules, targets and source code for project...
Found Visual Studio installation: C:\Program Files\Microsoft Visual Studio\2022\Community (Product=Microsoft.VisualStudio.Product.Community, Version=17.4.33205.214)
Error while enumerating Visual Studio toolchains
COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
   at Microsoft.VisualStudio.Setup.Configuration.ISetupInstance2.GetState()
   at UnrealBuildTool.MicrosoftPlatformSDK.FindVisualStudioInstallations(ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Platform\Windows\MicrosoftPlatformSDK.cs:line 780Wrapped by BuildException: Error while enumerating Visual Studio toolchains
   at UnrealBuildTool.MicrosoftPlatformSDK.FindVisualStudioInstallations(ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Platform\Windows\MicrosoftPlatformSDK.cs:line 823
   at UnrealBuildTool.VCProjectFileGenerator.SetupSupportedPlatformsAndConfigurations(Boolean IncludeAllPlatforms, ILogger Logger, String& SupportedPlatformNames) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\VisualStudio\VCProjectFileGenerator.cs:line 294
   at UnrealBuildTool.ProjectFileGenerator.GenerateProjectFiles(PlatformProjectGeneratorCollection PlatformProjectGenerators, String[] Arguments, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\ProjectFiles\ProjectFileGenerator.cs:line 858
   at UnrealBuildTool.GenerateProjectFilesMode.Execute(CommandLineArguments Arguments, ILogger Logger) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\Modes\GenerateProjectFilesMode.cs:line 233
   at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in D:\build\++UE5\Sync\Engine\Saved\CsTools\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 648
WriteFileIfChanged() wrote 0 changed files of 0 requested writes.

```

My DVDRom was on D so I thought that maybe it is failing because of it so I moved it further down. D is now free but it still fails.

I’ve been struggling with this the whole day and I’m out of ideas.  
What am I doing wrong?

PS  
Version 4.26 works fine 😶

---

<div class="post-metadata">

**Author:** ![fprebeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fprebeg](https://forums.unrealengine.com/u/fprebeg)\
**Post date:** [January 9, 2023, 7:12pm UTC](https://forums.unrealengine.com/t/cannot-generate-project-files-after-adding-c-to-a-blueprint-project-error-while-enumerating-visual-studio-toolchains/744469/2 "2023-01-09T19:12:56Z")

</div>

I have reinstalled everything from scratch, Visual Studio and Unreal Engine and still no luck. I keep getting the same error when I try to generate the project files.  
Please help, at this point, I’m desperate.

---

<div class="post-metadata">

**Author:** ![duchamp](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/duchamp/32/630690_2.png) [@duchamp](https://forums.unrealengine.com/u/duchamp)\
**Post date:** [June 14, 2023, 5:25am UTC](https://forums.unrealengine.com/t/cannot-generate-project-files-after-adding-c-to-a-blueprint-project-error-while-enumerating-visual-studio-toolchains/744469/3 "2023-06-14T05:25:44Z")

</div>

Experiencing the same issue today out of the blue, everything worked till yesterday. Did you find a solution?
