Reputation: 979
Using tsc command it's as easy as running:
tsc --out all.js js/*.ts
How can I configure Visual Studio to do that when I build my project?
Upvotes: 6
Views: 4045
Reputation: 1947
I've found a potentially easier solution by just modifying the build properties of the project (.csproj / .vbproj) you are building:
I'm unsure which version of Typescript that this feature was introduced in. But it seems a much simpler method than the svallory's solution
EDIT: Since Visual Studio 2015, it's now very easy to integrate Grunt/Gulp tasks and have them run in your builds. I've personally be really enjoying using Gulp for more granular control over what files I build and/or minify, and I highly recommend it. Using this guide as a starting point should help.
Upvotes: 3
Reputation: 144
It seems that the proposed solution is for typescript 0.8.1.1 and not 0.8.2
Upvotes: 1
Reputation: 979
Just got it. Add this line:
<Exec Command="tsc --out all.js @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
to the BeforeBuild
target of your .csproj
or .vbproj
file, like this:
<Target Name="BeforeBuild">
<Message Text="Compiling TypeScript files" />
<Message Text="Executing tsc$(TypeScriptSourceMap) @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
<Exec Command="tsc$(TypeScriptSourceMap) @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
<Exec Command="tsc --out all.js @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
</Target>
Upvotes: 2