Add a CopyFiles target to the build

Add a CopyFiles target to the build

Finally, we need to make sure that the Angular files are copied as part of the build. To do this, edit the project by right-clicking ‘Unload’ and then ‘Edit csproj’. After the TypeScript configuration PropertyGroup, add a new ItemGroup and Target to copy the angular files.

<ItemGroup>
  <NodeLib Include="$(MSBuildProjectDirectory)\node_modules\angular2\bundles\angular2.js"/>
  <NodeLib Include="$(MSBuildProjectDirectory)\node_modules\angular2\bundles\angular2-polyfills.js"/>
  <NodeLib Include="$(MSBuildProjectDirectory)\node_modules\systemjs\dist\system.src.js"/>
  <NodeLib Include="$(MSBuildProjectDirectory)\node_modules\rxjs\bundles\Rx.js"/>
</ItemGroup>
<Target Name="CopyFiles" BeforeTargets="Build">
  <Copy SourceFiles="@(NodeLib)" DestinationFolder="$(MSBuildProjectDirectory)\Scripts"/>
</Target>

Now right-click on the project and reload it. You should now see node_modules in the Solution Explorer.

doc_TypeScript
2016-10-04 19:24:58
Comments
Leave a Comment

Please login to continue.