- Create an ASP.NET Core 3 project with the React Template in Visual Studio.
- Remove the Content of the "ClientApp" Folder.
- Create a react app with create-react-app in an arbitrary folder somewhere else. For example:
npx create-react-app myapp --typescript
- Copy the content of the created Typescript React app into the "ClientApp"-Folder.
- Visual Studio should prompt you to install the Typescript NuGet Package. If it does not, you can add the reference manually:
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="3.7.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
- You now have a working, debuggable default react app with Typescript running with ASP.NET Core.
Porting the bootstrap app included in the default Visual Studio templates needs a few additional steps (libraries, typings, ...). The "AspNetCoreReactTypescript-Bootstrap" folder contains an example how a Typescript port of the template could look like.