Add existing React application as a React project in VS 2022

Kuljit 0 Reputation points
2023-10-25T20:24:44.03+00:00

Hi,

I was looking into the below link where it shows how to create a react app in VS 2022

https://learn.microsoft.com/en-us/visualstudio/javascript/tutorial-create-react-app?view=vs-2022

Is there any way we can add an exising react application and run it in similart way from VS 2022.
Related to the question, how can we create react project file from an exising React application folder.

Thanks,
Kuljit

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,793 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 28,846 Reputation points Microsoft Vendor
    2023-10-26T03:36:19.3233333+00:00

    Hello @Kuljit,

    Welcome to Microsoft Q&A forum.

    Based on the tests, there’s no way to directly port the existing React application to a React project in VS 2022.

    Visual Studio has a feature to create a new project from existing code(File > New > Project From Existing Code…), but it only supports Visual C++, PHP, Visual Basic and C# type of project currently.

    You can directly open the folder which contains the existing React application(File > Open > Folder…), but only four npm tasks are available(right-click the package.json file > Npm): npm run-script start, npm run-script build, npm run-script test and npm run-script eject. The .esproj file(project file) and the .sln file(solution file) will not be generated automatically, so it’s still not a project.

    You may try to create and use a new React project in Visual Studio.

    Please feel free to let us know if you have any further concerns.

    Best Regards,

    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.