I have two projects in VS2012. One created as a "HTML App with Typescript" and one (a DLL) where I added a Typescript file to an existing project (I added the BeforeBuild Target to the existing project).
When I compile the HTML App project it compiles the TS to JS just fine and add the JS as content.
When I compile my DLL I do not get any results form the TSC...neither in the folder I put the TS file nor in the root or any other folder...I do not get any errors or other hints what could be wrong.
In the properties of both projects the TS file shows as:
BuildAction: TypeScriptCompile
Copy to output....: Do not copy
In the .csproj file the section inside the item group looks like:
<ItemGroup>
...(Lots of other "EmbeddedResources" in this ItemGroup)
<TypeScriptCompile Include="C-DCommunication\ClientBin\CDEHTML5\cdeUX5.ts" />
<Content Include="C-DCommunication\ClientBin\CDEHTML5\cdeUX5.js">
<DependentUpon>cdeUX5.ts</DependentUpon>
</Content>
...(more files in my ItemGroup)
</ItemGroup>
It looks to me like the TSC compiler does not parse the path correctly. Can somebody verify?
Thanks
When I add TypeScript to an existing project, I tend to add the following to my project file:
<ItemGroup>
<AvailableItemName Include="TypeScriptCompile" />
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Include="$(ProjectDir)\**\*.ts" />
</ItemGroup>
<Target Name="BeforeBuild">
<Exec Command=""$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.0.0\tsc" @(TypeScriptCompile ->'"%(fullpath)"', ' ')" />
</Target>
Source
But if you use the Web Essentials Visual Studio extension, it will compile the TypeScript to JavaScript on save, which I find gives a better flow to development.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With