Microsoft.NodejsTools.targets, Microsoft.NodejsToolsV2.targets, msbuild, VS2019, Ttypescript, Typescript, node_modules.
So I just switched over to using Visual Studio 2019 (from 2017) and found that creating a new Typescript web project uses Microsoft.NodejsToolsV2.targets instead of Microsoft.NodejsTools.targets which requires using a Typescript install in node_modules instead of the built-in SDK. This got me excited because I thought I'd be able to overwrite a variable to point to the custom wrapper for tsc that I'm using (ttypescript), but unfortunately not the case.
Currently it is possible to switch the build & clean version of tsc over to a custom location by creating your own .targets file and c# script to run tsc with the provided configuration and providing all the settings as appropriate (as I have done), however the tsc used by CompileOnSave is hardcoded into the SDK, and cannot be changed using msbuild. So I've lost all compile on save support (if I turn CompileOnSave on my output is overwritten by javascript that doesn't run).
So I'm requesting the ability to specify explicitly where tsc is located, so that I can use a custom wrapper instead of the default tsc in VS2019. I'm perfectly fine for this to be only available within msbuild or the project properties.
This will allow me to use the experimental typescript transforms prior to the official implementation within vs 2019 across my projects while still being able to use compile-on-save.
I don't know what to put here aside from what I've already said.
My suggestion meets these guidelines:
Whenever I raise these issues people tell me to switch to VS code. Please don't. I'm too dependant on the VS->Azure workflow to make the switch.
@PranavSenthilnathan @minestarks @jessetrinity?
I think there are a couple of points of confusion to clear up here.
tsserver.js, not tsc.js - so unless you have a custom wrapper for tsserver too, it's not going to be possible to wire up your custom bits to Compile On Savetsserver.js, you can use this unsupported registry key to point VS to it.From the VS developer command prompt:
CD "%VSINSTALLDIR%"
vsregedit set . HKLM TypeScriptLanguageService CustomTSServerLocation string "full_path_to_my_custom_tsserver.js"
I'm going to re-emphasize that this setting is unsupported and its behavior may change in future versions of VS - but then so is using a custom tsc wrapper 馃檪
Thanks for the quick reply, that was a lot faster than I was expecting. I do in fact have a custom tsserver..js! (I'm using ttypescript which generates both)
It's not clear from the key itself, but I'm guessing that changing that value changes the tsserver used for all projects?
I have two solutions on the same PC which I'm actively working on and only one of them uses the changed tsc. Is there a way for me to change the tsserver for only that solution?
Edit: To clarify I work on the two solutions separately. I'd want the custom tsserver to be used for all projects in a single visual studio instance, and a normal tsserver for another instance. I do not want them running side-by-side I just don't want to have to continually edit the registry to switch between them.
If the registry edit just adds another entry to the project's TypeScript version drop-down (in project settings) that would be the most perfect.
@minestarks any chance on getting some clarification on this?
I would just try it, but I'm pretty sure you should be able to lock yourself to a specific TS version at a project-level granularity. https://github.com/Microsoft/TypeScript/wiki/Updating-TypeScript-in-Visual-Studio-2017
@DanielRosenwasser the question was does using the custom registry key override all typescript versions, just one of them or create a new entry?
Your link seems to be about changing typescript versions in general (with different SDKs) which is exactly what I was talking about in the last sentance of my last post. I'm already aware that drop-down exists I just wanted to confirm that the registry key would work with that drop-down rather than clobber it.
I don't like editing my registry on a whim, so I'd prefer to know in advance whether or not I can use it, particularly since I use this machine for work on a project that doesn't have an altered compiler, so it's pretty important that I know that that's not going to break.
The reg key should be removable if it doesn't work but I won't pressure you into changing it if you're not comfortable with that.
I'm not sure, @PranavSenthilnathan or @minestarks may be able to answer this.
Setting the key clobbers. I think you can also set the CustomTSServerLocation in the command line before launching VS a la https://github.com/microsoft/JSTSdocs/blob/master/articles/troubleshooting/index.md.
Since you have your own custom tsserver though, you should be able to create your own "SDK version". Below is what I just tried and I would normally not recommend doing this, but since you have a custom tsserver I don't think I can stop you:
C:\Program Files (x86)\Microsoft SDKs\TypeScript.6.6.6.6 folder. I don't know what ttypescript does, but if you're working with the TypeScript repo you can just copy the contents of typescript\built\local.6.6 version when you select the version for your project. You're likely to see something break like localization, but I do see the right node process starting on my machine.I would really like to add a menu to VS that just lets you restart the server, select version, etc...
Ooooh! Thank you @jessetrinity for the answer and the workarounds. I'd love to see a menu like that too, but making a custom SDK works too.
Could I name it 0.1 since 0.8 was the first public build, so it shouldn't be able to ever conflict?