To add a TypeScript component to a non-TypeScript Visual Studio project, add the following to the end of the project .csproj file (do this in notepad or somesuch; adjust the TypeScript path version accordingly):
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Target Name="TypeScriptCompile" BeforeTargets="Build"> | |
<Message Text="Compiling TypeScript files" /> | |
<Exec Command=""$(MSBuildProgramFiles32)\Microsoft SDKs\TypeScript\1.6\tsc" -target ES5 @(TypeScriptCompile ->'"%(fullpath)"', ' ')" /> | |
</Target> |
Reload the project and away you go. When you add TypeScript files to your project, you can set their BuildAction properties to TypeScriptCompile, if this doesn't happen automatically.
No comments:
Post a Comment