Home > Back-end >  Visual Studio exhibits inconsistent behavior in Create a new C project
Visual Studio exhibits inconsistent behavior in Create a new C project

Time:09-02

I'm using Visual Studio Community 2022 (64-bit), Version 17.1.6 according to VS Help->About but 17.3.2 according to VS Installer, on Windows 10. I've been programming in C# for some time and decided to try C .

I downloaded the workload Desktop development with C through VS Installer->Modify. But I cannot see the C project templates in the Create a new project form.  enter image description here

If I click Next in the above form, a C# project is created. Using VS Installer I

  • run Repair VS
  • uninstalled Desktop development with C  
  • installed Desktop development with C again.

  When I start VS from VS Installer->Launch, I get a long list of C templates. enter image description here

But when starting VS directly, without Installer, no templates are found.

CodePudding user response:

I have found the reason for this behavior. I start VS using an icon (shortcut) pinned to start in Windows 10. This icon was pointing at an old version of VS. When VS was updated and a new workload was added, this icon still pointed to the old VS version. 

I removed this icon and created a new one, and everything works fine now.

A VS shortcut points at ..\Microsoft Visual Studio\2022\Common7\IDE\devenv.exe. In my case, there were two copies of this file tree; one under C:\Program Files\ and the other under D:. The other was correct, but at some update VS Installer neglected this configuration and selected the C: drive by default.

  • Related