TypeScript Version: SDK installer 2.3.3
Prerequisites: Machine with only the BuildTools for Visual Studio 2017 installed.
Expected behavior:
Installing the TypeScript SDK on a machine with only BuildTools 2017 intalled, the SDK installer should also install the needed msbuild targets and props under the folder C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript. The SDK itself is installed as expected in the folder C:\Program Files (x86)\Microsoft SDKs\TypeScript.
Actual behavior:
The msbuild files under C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript are missing. It seems like currently these are only installed if a full VisualStudio installation could be found.
The problem still exists, also with TypeScript 2.4.1 SDK.
have you tried installing the VS 2015 installer, it will install the tools even if VS is not installed on the machine.
Also consider using the TS Nuget package instead.
Well I've tried your mentioned VS2015 installer, but it doesn't change anything. As said before the SDK is installed, but not the targets under C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript where msbuild is going to search for building the typescript project.
It behaves exactly the same way as the VS2017 installer.
Using the nuget package is going to help, but I find it quiet not intuitive, especially one has to remove some imports manually. Well I know that's by design how nuget works 😄 . As that is only a one time thing, that shouldn't be a big problem.
But what is VisualStudio going to do when TS is installed through nuget? Let's say we have TS 2.4 installed as a nuget package, but on the machine (through the TS installer) there's only TS 2.3 installed. So building through msbuild or from VisualStudio TS 2.4 will be used, but what is VisualStudio going to use for intellisense and background compilation? Will it also use TS from the nuget package?
@stffabi Are you running 15.3? TypeScript 2.3 (and higher SDKs) requires Visual Studio 2017 version 15.3.
We should have been clearer about communicating that -- the 2.3 language service will work fine with 15.2, but the build tools not so much.
You're correct to point out that the SDK installer doesn't update the targets files under the VS directory, but with 15.3, the targets files under the VS directory should be locating and importing the latest installed TypeScript files on your machine (in this case 2.3).
But what is VisualStudio going to do when TS is installed through nuget? Let's say we have TS 2.4 installed as a nuget package, but on the machine (through the TS installer) there's only TS 2.3 installed. So building through msbuild or from VisualStudio TS 2.4 will be used, but what is VisualStudio going to use for intellisense and background compilation? Will it also use TS from the nuget package?
Visual Studio will not use the nuget package for Intellisense -- it will use what's on the machine (2.3 in your example). So yes for full Intellisense support you'll want the SDK installed.
@minestarks I'm trying to get TS run with Visual Studio 2017 BuildTools (15.3) only installed. I would like to only install the build-tools on our build servers and not the complete VisualStudio 2017 (15.3). The problem is that the SDK installer doesn't install the targets (which are needed to locate and import the correct TS version files) under Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript on build-tools only machines. Nor does the build tools installer install the "locating" targets under the above directory.
But I think we are going to use the nuget packages, which will fix the problem for our build-servers. For the developer experience we are going to additionally install the SDKs on the developer machines.
Something still isn't adding up if this scenario isn't working for you without Nuget. The SDK installer doesn't place anything under the Visual Studio folder, but the build tools scenario is still expected to work.
The problem is that the SDK installer doesn't install the targets (which are needed to locate and import the correct TS version files) under Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript on build-tools only machines.
Expected.
Nor does the build tools installer install the "locating" targets under the above directory.
Not expected. To confirm:
Does your Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript\Microsoft.TypeScript.targets file have this line?
<Import Project="$(TypeScriptSdkDir)\versions\*" />
This is the part that goes looking for the installed TypeScript SDKs under C:\Program Files (x86)\Microsoft SDKs\TypeScript . If it's not there, then this may be a setup problem on VS's part, I'd need to check on that.
If it's there, then we should be locating the installed TypeScript SDKs and selecting the highest one by default, unless you specified a TypeScriptToolsVersion in your project that's different.
Nor does the build tools installer install the "locating" targets under the above directory.
Not expected. To confirm:Does your Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript\Microsoft.TypeScript.targets file have this line?
No, the folder Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript\ is completely missing. I've installed BuildTools 15.3.26730.8 with the components Microsoft.VisualStudio.Workload.MSBuildTools, Microsoft.VisualStudio.Workload.WebBuildTools, Microsoft.VisualStudio.Component.Static.Analysis.Tools. Do I need an additional component for these targets to be installed?
Thanks @stffabi for the very detailed info. As you've probably figured out by now, the problem is that the Build Tools VS setup graph is missing the necessary TypeScript components -- sorry about that. I'll look into getting them added. I think your NuGet workaround is the most sensible solution for now, until we get VS build tools setup fixed.
Thanks for helping me track this down!
Does anyone know if this has been fixed with the BuildTools for Visual Studio 2017 15.4?
It has not been added to the BuildTools yet.
@minestarks @billti Any plans when this will be fixed?
It will not be a part of the upcoming VS 2017 Update 5 releases, which means at least a few months away. I'm working on it.... we just don't have a solution ready in time for the next release.
Had the same problem after migrating a project from VS2015 to VS2017, TS project would not build on a build agent that only has the Build Tools. Ended up using the nuget package as suggested by @mhegazy (thank you).
However, it'd be nice to have a solution that didn't involve using a nuget package.
Build support for TypeScript has been added to the Build Tools SKU of Visual Studio 2017 since Update 6 (see https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2017-relnotes-v15.6#BuildTools ).
Most helpful comment
have you tried installing the VS 2015 installer, it will install the tools even if VS is not installed on the machine.
Also consider using the TS Nuget package instead.