Error in Visual studio 2019.. "can't open source file"

TEJAS KACHHIA (EXTERNAL) 0 Reputation points
2023-09-12T20:09:26.7433333+00:00

When I insert my project in visual studio... it's showing me errors when I opened any source or header files from my folder... In fact the location is on right path.. but getting errors. How to solve this?

User's image

Developer technologies Visual Studio Other
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,436 Reputation points Microsoft External Staff
    2023-09-13T09:01:19.6133333+00:00

    Hello @TEJAS KACHHIA (EXTERNAL) ,

    Welcome to Microsoft Q&A forum.

    Perhaps some components/SDKs are missing. Please open VS Installer > Modify > Individual components > choose to install Windows 10/11 SDK. After installing the Windows SDK, open VS and your project, click Project > Retarget solution > in "Review Solution Actions" window, select the corresponding Windows SDK version > click OK.

    Since we cannot confirm the specific source files which cannot be opened on your side, you may check if there’s any other components that you need to install from VS Installer > Modify > Individual components.

    Here's a similar thread: Visual Studio 2022 "Cannot open source file" issue for you to refer to.

    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.


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.