Error in Visual Studio 2022 and C++: "The Document cannot be opened. It has been renamed, deleted or removed."

Azureus 0 Reputation points
2023-04-19T13:55:11.5766667+00:00

I ran into this problem building a project in Visual Studio 2019. I think it also happens in the 2022 version. Regardless of the version I searched all over Google with my Google-fu skills and I haven't found any answers. I have a C++ project. Its a console application. I read that the project template is important. Its not made with cmake. I tried opening a .cpp file in the solution folder of my project. Lets call it GUI.cpp. When I double click I get an error that says "The Document cannot be opened. It has been renamed, deleted or removed.". This happens all the time with other files in the project. I had to delete files and start again with new ones. I can't find a work around with this.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,614 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,530 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,354 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Tianyu Sun-MSFT 27,356 Reputation points Microsoft Vendor
    2023-04-20T03:56:33.3633333+00:00

    Hello @Azureus,

    Welcome to Microsoft Q&A forum.

    We may first check and confirm that the error message says correctly or not correctly.

    When the issue appears, please right-click your project => Open Folder in File Explorer => confirm that the GUI.cpp file exists => make sure that the file has the same name with the displayed item in VS Solution Explorer => go back to Visual Studio => right-click your project => Unload Project => right-click it again => Reload Project => Build your project => double click the GUI.cpp file and check if it opens without any errors.

    If the GUI.cpp file does exist, and it wasn’t renamed, removed or deleted, then please check following:

    1. Cache: Close VS => go to solution folder => remove the hidden .vs folder => open VS and try to open GUI.cpp file again.
    2. VS settings: Reset VS settings by running devenv /ResetSettings command in Developer Command Prompt for Visual Studio 2022 and repair Visual Studio from Visual Studio Installer => More => Repair.
    3. Extensions: Did you use any extension which may remove/rename files automatically? If so, please try to disable them.
    4. Project configurations: Did you set any configurations in your project/project file/project properties like pre-build event/post-build event which may remove the files?
    5. Project synchronization: Is there any other team member who is also developing this project may change something?

    Please feel free to let us know the results.

    Sincerely,

    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.


  2. Ryan haris 0 Reputation points
    2023-04-22T19:36:28.41+00:00

    Hey Azureus, it occured to me as well. I have noticed some anti-virus software may interfere with Visual Studio's ability to access files. You can also try to reinstall software and check again. Updating: I have used visual studio for mobile app aims to educate and help hunters and outdoorsmen using various inpurts from environments. Notably, some old hunting lads from treestandranger needed thos to navigate in private hunting territories. Worked like a charm!


  3. nathan 0 Reputation points
    2024-04-18T11:36:47.12+00:00

    "The document's format is either unsupported or the document contains binary characters, opening with a different application."
    Visual Studio error let me specify.

    im trying to create a a database when i open that the error. what steps to take

    0 comments No comments