I'm working with a default ASP.NET 5 Web project template and trying to determine how to dictate the TypeScript tools and ultimately compiler version for my application.
I'm not yet using Gulp
so this post's answer does not seem to hold water. The reason being, my app even without Gulp has to be told which TypeScript compiler to use. This answer as well wasn't about finding the version but rather using features not yet supported.
In VSNET 2013, the TypeScript tools version and compiler targeted was set in the project's properties:
<TypeScriptToolsVersion>1.7</TypeScriptToolsVersion>
I believe it to be an option of the compilerOptions
section of my tsconfig.json
file. However I get no intellisense for version
and it appears the documentation is sparse. This link states it just emits the compiler's version but doesn't allow specifying it.
I currently have version 1.6 and 1.7 installed on my machine. If there is a need for me to dictate a specific compiler version, how do I set that in an ASP.NET 5 web template? Again the answer isn't immediately to use Gulp because it builds and compiles my .ts
files as is now, so something is dictating the compiler being used.
The -g means it's installed on your system globally so that the TypeScript compiler can be used in any of your projects. Test that the TypeScript is installed correctly by typing tsc -v into your terminal or command prompt. You should see the TypeScript version print out to the screen.
If you only have TypeScript installed for Visual Studio then: Start the Visual Studio Command Prompt. Type tsc -v and hit Enter.
It appears the TypeScript Tools (and corresponding compiler version) for ASP.NET 5 projects is set in the following files:
TS 1.7: C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets
<PropertyGroup>
<TypeScriptToolsVersion Condition="'$(TypeScriptToolsVersion)'==''">1.7</TypeScriptToolsVersion>
<TscToolPath Condition="'$(TscToolPath)' == ''">$(MSBuildProgramFiles32)\Microsoft SDKs\TypeScript</TscToolPath>
<TscToolExe Condition="'$(TscToolExe)' == ''">tsc.exe</TscToolExe>
<TscYieldDuringToolExecution Condition="'$(TscYieldDuringToolExecution)' == ''">true</TscYieldDuringToolExecution>
</PropertyGroup>
TS 1.8 C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript
<PropertyGroup>
<TypeScriptToolsVersion Condition="'$(TypeScriptToolsVersion)'==''">1.8</TypeScriptToolsVersion>
<!-- Check the default folder for the nuget version of the installer first, if that exists we should use that. -->
<TscToolPath Condition="'$(TscToolPath)' == '' AND Exists('$(MSBuildThisFileDirectory)tsc\tsc.exe') ">$(MSBuildThisFileDirectory)tsc\</TscToolPath>
<TscToolPath Condition="'$(TscToolPath)' == ''">$(MSBuildProgramFiles32)\Microsoft SDKs\TypeScript</TscToolPath>
<TscToolExe Condition="'$(TscToolExe)' == ''">tsc.exe</TscToolExe>
<TscYieldDuringToolExecution Condition="'$(TscYieldDuringToolExecution)' == ''">true</TscYieldDuringToolExecution>
</PropertyGroup>
Notice the 1st line in the configuration above has the value 1.7
for the TypeScript 1.7 compiler.
Visual Studio 2015 IDE will use TypeScript that is specified in PATH. If you can change it from TypeScript 1.7 to 1.8, it will work with ASP.NET 5 apps and other apps as will.
Don't need to use GULP, I hope your using VS IDE or its VS Code
This approach will force all other applications to use TypeScript 1.8 only, however non ASP.NET 5 apps have entry in proj files.
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