2. Create the project
Use the new project wizard in Visual Studio.
- Start Visual Studio and choose Create a new project.
- Search for React and select the React and ASP.NET Core template (a JavaScript template). Some Visual Studio versions word it as "ASP.NET Core with React".
- Choose Next, then give the project a name, for example
ReactWithAspNet, and a location. - On the additional information page, choose the framework (.NET 10) and any options offered, such as HTTPS and Docker support.
- Choose Create.
The first load can take a few minutes while npm restores the client's dependencies. Watch the Output window and the npm node in Solution Explorer.
Command-line alternative: the .NET CLI also has SPA templates. Run
dotnet new list react to see what your
installed SDK offers. The Visual Studio template described here is the one with a separate .esproj front end.
Recommended first checks
- Build the solution (Ctrl+Shift+B) and confirm no errors.
- Open the server project's Properties → Debug and note the HTTPS
applicationUrl; you'll need its port. - Commit the solution to source control, with
node_modulesanddistin.gitignore.