This guide applies only to ASP.NET 4.x. Please consider using webpack if possible.
Just want to see the code? Check out the sample project.
To use it, first reference the
TransformBabel task, and then call it wherever
<UsingTask AssemblyFile="tools\React\React.MSBuild.dll" TaskName="TransformBabel" /> <Target Name="TransformBabel"> <TransformBabel SourceDir="$(MSBuildProjectDirectory)" TargetDir="" /> </Target>
To get started easily, you can install the React.MSBuild NuGet package which will
automatically modify your web application's
.csproj file to reference the task
and run it after every site compilation. To customise the process (for example,
to only compile the JSX files for release builds), modify the
build target that was added to the csproj file.
The NuGet package is good for getting started quickly, but it has some
limitations. The package needs to add a reference to
though this assembly is only used at build time and not actually used at
runtime. Instead of using the NuGet package, you can just manually copy all the
assembly files into a folder (such as
tools\React) and just reference the task