Visual Studio 2022 hides *.cs files

Nicolai Lupascu 0 Reputation points
2023-03-06T07:39:56.43+00:00

Hi everyone,

I have a problem with the new Visual Studio 2022. Every time a project is started it creates a Program.cs file. If Visual Studio is closed and then opened again this file is not visible. It is still available and one can see it in File Explorer, but not in Visual Studio. Then another file is created the old on is shown but with a little x on it. The same happens with other files if Visual Studio is closed again.

User's image

Any help is appreciated.

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

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    2023-03-06T11:45:45.8433333+00:00

    Hi @Nicolai Lupascu

    Welcome to Microsoft Q&A! 

    Are you using version control? How did you open the file after closing VS? 

    If you rename or delete the files (Class1.cs and Program.cs) from the project folder, they will show in Solution Explorer with a little red x.

    Or these files are moved to different folders. Please check it. 

    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.


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.