Visual studio 2022 community Version 17.9.3

Moujahed Hassan 0 Reputation points
2024-03-15T13:58:35.67+00:00

Hi when I would like to add a class file

by right clicking add class , I have by default the type view.xmal and can’t find the type class in the template list

Developer technologies | Visual Studio | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 60,346 Reputation points
    2024-03-15T15:15:54.7+00:00

    If I understand correctly you are right clicking the project node or one of its folders in Solution Explorer and then selecting Add \ Class. Once you do that you are getting thrown into the Item UX but it is not selecting the Class template?

    First question, do you have a C#/C++/VB project open in Visual Studio? Screenshots might help here. A class only makes sense in a code project. Non-code projects, like SSRS projects, don't use classes.

    In Solution Explorer right click the project or any of its folders and select Add \ New Item. In the Item UX do you have Class as an option? If not then either you don't have a coding project open or you are missing workloads.

    You can also try creating a new console app and confirming the Add Class works there. That would eliminate configuration issues.

    Please clarify what you're seeing and what you're doing. Also please confirm what type of project you have.


  2. Moujahed Hassan 0 Reputation points
    2024-03-16T11:39:35.7033333+00:00

    the problem was fixed by adding .NET Framework project and items templates to visual studio 2022
    User's image

    Thank you

    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.