Typescript won't install into C:\Program Files (x86)\Microsoft SDKs\TypeScript' - visual-studio

My issue might be related to this one: No TypeScript compiler was found at C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc.exe but I want to ask a different question.
When trying to install Typescript (currently 1.8.36) into Visual Studio 2013 or 2015, I don't see it installed into the Microsoft SDKs\Typescript folder. I'm pulling the install packages from http://www.typescriptlang.org, but I can't determine where the compiler gets installed and using 'where tsc' in Cmd isn't showing me anything useful. I know the latest releases of VS include TS, but they only go up to 1.8.10, and besides when trying to build my solution I get the issue I linked to, so something isn't right.
I've removed Productivity Tools and Web Essentials from both VS 2013 and 2015 and reinstalled TS but no luck.
So my question is how do I install the Typescript compiler into VS 2013 Update 5 or VS 2015 Update 3 such that MSBuild will find something at C:\Program Files (x86)\Microsoft SDKs\TypeScript\(TypescriptVersion) and compile my solution?

I ran into the same issue, the Typescript in SDKs directory comes once you install the extension into any version of Visual Studio. So to install Typescript version 1.8 do the following:
Open Visual studio
Click on Tools > Extensions and Updates
On the left side select, Online group
Search typescript
From the results select your desired version (in your case 1.8)
Click install, it will download a small web installer
Close the VS instance, and install the extension
Open your solution and try to build now
This should work just fine.

Related

Visual Studio 2022: Cannot open include file: 'ctype.h'

I've got the infamous error message in C++ build: "Cannot open include file: 'ctype.h'". I know a similar question was already asked multiple times, but my case seems different because I am using the latest Visual Studio 2022 and seems to behave differently.
I have a bunch of existing C++ projects, they use plain 32-bit Windows API with DirectX 6, and I used VC++ build tools 2015 and Windows SDK 8.1 to compile it without any issues in previous versions of Visual Studio. Everything was fine in Visual Studio 2019, no special setup was needed, until I uninstalled it and installed Visual Studio 2022.
Now I can open my solutions, it nicely shows they are using C++ build tools 2015, which I installed together with VS2022, and the solutions also shows correctly that they use Windows 8.1 SDK. But Windows 8.1 SDK is not present in VS2022 installation, I installed it separately. I also tried to "repair" VS2022 installation, but that only deleted all my UI preferences, but not fixed anything in build. Also, I tried to reinstall Windows 8.1 SDK, but it said it is already OK.
When looking to Visual Studio, I can't see any place where I can set default include and lib directories, I can only list what is being used right now. VS2022 shows this list:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include
C:\Program Files\Windows Kits\10\Include\10.0.10240.0\ucrt
C:\Program Files (x86)\Windows Kits\8.1\Include\um
C:\Program Files (x86)\Windows Kits\8.1\Include\shared
C:\Program Files (x86)\Windows Kits\8.1\Include\winrt
The actual error message I receive is this:
c:\program files (x86)\windows kits\8.1\include\um\winnt.h(31): fatal error C1083: Cannot open include file: 'ctype.h': No such file or directory
So it says that winnt.h from windows kits 8.1 cannot find ctype.h. And yes, there is no ctype.h in that folder or anywhere around, I can see it only in C:\Program Files\Microsoft Visual Studio\2022\Professional\SDK\ScopeCppSDK\vc15\SDK\include\ucrt
which I think is the folder with VC++ 2015 build tools. So this seems correct, but I am wondering why this folder is not a part of default include directories when VC++ 2015 build tools are set in project settings. Because it seems that VS2022 is correctly picking my Windows 8.1 SDK, but not picking correctly the older C++ compiler.
When I try to add the folder where ctype.h resides to include folders, I receive another type of errors saying that other files are incompatible with these include files. Of course, this system of directories needs to be in sync. So please what is the correct way of using this?
Also, I tried to switch the VC++ build tools to 2022 version. Unfortunately, that also does not fix the issue. And Windows 10 SDK is not installed, the software wants to stay compatible with older Windows, so I don't need it.
I found a bug report which is related: https://developercommunity.visualstudio.com/t/windows-81-sdk-1/151682
Although Microsoft staff declined to accept it as a bug, it is happening for me as well. When I install only Windows 8.1 SDK, no project can be compiled with it. I even tried to create a new Windows API project in VS2022, the project was created, but failed to compile with the same error.
So I tried to install Windows 10 SDK (from VS2022 installed, but that is probably not important) and this added some missing files which now help to compile Windows 8.1 SDK projects. Problem seems to be solved, my old C++ code can now be compiled with Windows 8.1 SDK and both C++ build tools 2015 and 2022.

Visual Studio 2017 does not detect Windows Driver Kit installation

I already have Visual Studio 2017 professional with Desktop Development with C++ installed.
I am trying to build the Virtual Serial project found here:
https://github.com/Microsoft/Windows-driver-samples/tree/master/serial/VirtualSerial
When I try to build it, I get the error:
Severity Code Description Project File Line Suppression State
Error MSB8020 The build tools for WindowsUserModeDriver10.0 (Platform Toolset = 'WindowsUserModeDriver10.0') cannot be found. To build using the WindowsUserModeDriver10.0 build tools, please install WindowsUserModeDriver10.0 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". virtualserial C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets
I cannot find any instructions on installation aside from this website.
https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk
I downloaded the WDK for Windows 10, version 1803.
I closed VS2017 and ran the installer.
When running the installer I got the message in the screenshot below, I clicked Next to continue installing
After running the installer, the project still does not build, with the same error: WindowsUserModeDriver10.0 is not installed.
What am I missing during installation? Is this the correct installer for regular VS2017 (not community edition)?
Thanks,
I know this is old, but I recently fell into this rabbit hole. What worked for me was uninstalling all of the WDKs, rebooting, and installing WDK 1803 (the wdksetup.exe program downloaded from Other WDK downloads shows version 10.0.17134.1 in properties). That WDK installer specifically calls out VS 2017 when you add the Visual Studio integration at the end of the install process.
In my situation, I installed vs2022 with SDK 19041 and WDK 19041.
After some testing, I realized that VS2022 only supports WDK 22621(so on this date). So I installed WDK 22621 and SDK 22621, and problem solved.
If you still can't find Kernel Driver Build option, try run this file C:\Program Files (x86)\Windows Kits\10\Vsix\VS2022\10.0.22621.0\WDK.vsix(WDK 19041 only has VS2019). It's a Visual Studio's extension.
According to this: https://answers.microsoft.com/en-us/windows/forum/windows_10-hardware-winpc/windows-wdk-on-visual-studio-2017-community/fdbd2b44-e57a-4849-903d-04001205a764
WDK is not currently supported by visual studio 2017.
This is ridiculous

No TypeScript compiler was found at C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc.exe

I installed Visual Studio 2015 and TypeScript 1.8.6 for Visual Studio 2015. After creating a new TypeScript project and building, I get this build error:
No compiler was found at C:\Program Files (x86)\Microsoft
SDKs\TypeScript\1.8\tsc.exe
Indeed, tsc.exe is missing in the file system.
Things I've tried:
Uninstall and re-install TypeScript Tools for Visual Studio 2015 1.8.6.0
Uninstall and re-install TypeScript Tools for Visual Studio 2013 1.8.5.0
Repair TypeScript Tools for Visual Studio 2015 1.8.6.0
I HAVE tried turning it off and on again :-)
Any clue on how to solve this? Which component installs the TypeScript SDK?
MSBuild is looking in the wrong place for tsc.exe
It should be looking in 'C:\Program Files (x86)\Microsoft SDKs\TypeScript\ tsc version \tsc.exe'
e.g. C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.8\tsc.exe
The one thing the TypeScript SDK installer wont do, is upgrade your existing projects. So all that reinstalling wont change anything. However, if you want MSBuild to use the newer compiler, you can upgrade your project yourself.
I don't think there is any way to do this through the UI, but it's easy enough to edit the Project file.
It needs to contain this in the first PropertyGroup
<TypeScriptToolsVersion>1.7</TypeScriptToolsVersion>
If you want the build to use v1.8.6, you need to set
<TypeScriptToolsVersion>1.8</TypeScriptToolsVersion>
In your case, I'm betting it's not there at all. So you should just add it.
I'm not experienced with using the TypeScript tools for Microsoft.. what you could do is use Gulp or Grunt tasks to compile TypeScript, this will even allow you to compile the TypeScript files everytime your save your .ts files.
You will need NPM (Node Package Manager) to install Gulp or Grunt and then install the package for compiling TypeScript.
You can find some information about the Grunt TypeScript package here: https://www.npmjs.com/package/grunt-typescript
Or for information about the Gulp TypeScript package, check this: https://www.npmjs.com/package/gulp-typescript
I've read through the comments on this issue on the TypeScript Github repo. Although this is a different issue, I did find a clue: repairing Visual Studio 2015 (through the Control Panel) installed tsc.exe in the correct folder.

Visual Studio 12.0: missing library "msvcmrt"

I'm trying to use Visual Studio 2015 to compile a VC++ project that, however, targets the Visual Studio 2013 build tools.
I noticed that the Visual Studio 2013 (12.0) tools and libs seem to have been installed alongside VS2015, as I see the C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib directory, with all the libs. Seems fine.
But... it's not. Two lib files are be missing: msvcmrt.lib and msvcmrtd.lib, and without these I cannot compile the project.
My question is: how do I acquire these? Do I have to install VS 2013 from scratch? Or is there a more convenient package available to install? Or is my VS2015 installation damaged, and the files should have been there?
I had a similar issue and I solved it by simply copying msvcmrt*.lib from a machine with vs2013 installed.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib
There'll be 6 files to copy (x86/arm/x64) * (debug/release)

Where can I find the TypeScript version installed in Visual Studio?

Maybe it's obvious, but I checked everywhere (besides the right place) and googled it. Nothing.
If you only have TypeScript installed for Visual Studio then:
Start the Visual Studio Command Prompt
Type tsc -v and hit Enter
Visual Studio 2017 versions 15.3 and above bind the TypeScript version to individual projects, as this answer points out:
Right click on the project node in Solution Explorer
Click Properties
Go to the TypeScript Build tab
Two years after the question was asked, using Visual Studio Command Prompt still did not produce right answer for me. But the usual Help|About window seems working these days:
UPDATE (June 2017):
VS 2013 does NOT show this info. (Later note: VS 2017 Enterprise edition does not show this info either).
VS uses Microsoft Build Engine (MSBuild) to compile Typescript files. MSBuild can support several major releases of Typescript, but About window shows only the latest one.
Here is how to get to the bottom of it:
A. To check which versions of Typescript are installed with your Visual Studio/MSBuild, inspect contents of C:\Program Files (x86)\Microsoft SDKs\TypeScript folder. For example, I have versions 1.0, 1.8 and 2.2:
B. Check which version of Typescript is requested by your project. In *.csproj file, look for <TypeScriptToolsVersion> tag, or you can add it if it is missing, like this
<PropertyGroup>
...
<TypeScriptToolsVersion>1.8</TypeScriptToolsVersion>
...
</PropertyGroup>
C. Finally, you can check, which version of Typescript is actually used by MSBuild. In TOOLS | Options | Projects and Solutions | Build and Run set MSBuild project output verbosity to Detailed:
Then build your project and inspect the output: you should see the reference to one of Typescript folders described in (A).
Based in the response of basarat, I give here a little more information how to run this in Visual Studio 2013.
Go to Windows Start button -> All Programs -> Visual Studio 2013 ->
Visual Studio Tools A windows is open with a list of tool.
Select Developer Command Prompt for VS2013
In the opened Console write: tsc -v
You get the version: See Image
[UPDATE]
If you update your Visual Studio to a new version of Typescript as 1.0.x you don't see the last version here. To see the last version:
Go to: C:\Program Files (x86)\Microsoft SDKs\TypeScript, there you see directories of type 0.9, 1.0 1.1
Enter the high number that you have (in this case 1.1)
Copy the directory and run in CMD the command tsc -v, you get the
version.
NOTE: Typescript 1.3 install in directory 1.1, for that it is important to run the command to know the last version that you have installed.
NOTE: It is possible that you have installed a version 1.3 and your code use 1.0.3. To avoid this if you have your Typescript in a separate(s) project(s) unload the project and see if the Typescript tag:
<TypeScriptToolsVersion>1.1</TypeScriptToolsVersion>
is set to 1.1.
[UPDATE 2]
TypeScript version 1.4, 1.5 .. 1.7 install in 1.4, 1.5... 1.7 directories. they are not problem to found version. if you have typescript in separate project and you migrate from a previous typescript your project continue to use the old version. to solve this:
unload the project file and change the typescript version to 1.x at:
<TypeScriptToolsVersion>1.x</TypeScriptToolsVersion>
If you installed the typescript using the visual studio installer file, the path to the new typescript compiler should be automatically updated to point to 1.x directory. If you have problem, review that you environment variable Path include
C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.x\
SUGGESTION TO MICROSOFT :-) Because Typescript run side by side with other version, maybe is good to have in the project properties have a combo box to select the typescript compiler (similar to select the net version)
The tsc -v command run technically reads the TypeScript compiler version within the SDK directory set within the Windows Path variable. This doesn't necessarily reflect the latest version installed as the Path variable is not updated with subsequent installations.
The version that VS.NET uses to compile the TypeScript is what's in the project's configuration:
<TypeScriptToolsVersion>1.5</TypeScriptToolsVersion>
To help explain this more in detail I created the following post which has the specifics on the TypeScript versions installed, and which version VS.NET uses to compile the TypeScript files.
Which Version of TypeScript is Installed and Which Version is Visual Studio Using?
I also added a feature request on Microsoft Connect to make viewing and switching the TypeScript targeted version in VS.NET easier. This isn't really a TypeScript feature request as much as it is a VS.NET IDE enhancement.
Allow switching TypeScript configured version from Project Properties IDE
The TypeScript team sorted this out in Visual Studio 2017 versions 15.3 and later, including the free Community edition.
How to See Which TypeScript Versions are Installed in Visual Studio
All you now need do is to go to project properties of any TypeScript Visual Studio project (right-click the project file in Solution Explorer/Properties), then go to the TypeScript Build tab on the left-hand side. This has a 'Typescript version' dropdown that shows you the version the project is using, and if you open it the dropdown shows you ALL versions of TypeScript currently installed in Visual Studio.
The actual installs are currently at C:\Program Files (x86)\Microsoft SDKs\TypeScript and then subfolders by version number, at least on Win10 on my computer. If you want to see the exact version (e.g. 2.8.3 rather than just 2.8) you can find the appropriate tsc.exe in here and look at its properties (Details tab in right-click/Properties in File Explorer).
How to Install Specific TypeScript Version
If you want to install a specific version of TypeScript then these can be found on Visual Studio Marketplace, although specific version numbers can be a little difficult to find in that list. A Google search for, for example, 'visual studio marketplace typescript 3.3.1' will usually find the exact version you want. If you install from here and restart Visual Studio the version will appear in the dropdown. Note also that some of the latest versions of TypeScript (e.g. 4.2) will refuse to install if there's a more recent version installed.
Node.js Console Applications
This answer does not apply to the 'Node.js Console Application' project type, which doesn't have a TypeScript Build tab in project properties. This is because it uses a version of TypeScript installed in the project folder using npm. The version can be seen and changed in the package.json file, and when installed appears under the npm entry in Solution Explorer, and in the node_modules/typescript folder on disk.
On Visual Studio 2015 just go to: help/about Microsoft Visual Studio
Then you will see something like this:
Microsoft Visual Studio Enterprise 2015
Version 14.0.24720.00 Update 1
Microsoft .NET Framework
Version 4.6.01055
...
TypeScript 1.7.6.0
TypeScript for Microsoft Visual Studio
....
You can run it in NuGet Package Manager Console in Visual Studio 2013.
As far as I understand VS has nothing to do with TS installed by NPM.
(You may notice after you install TS using NPM, there is no tsc.exe file).
VS targets only tsc.exe installed by TS for VS extension, which installes TS to c:\Program Files (x86)\Microsoft SDKs\TypeScript\X.Y.
You may have multiple folders under c:\Program Files (x86)\Microsoft SDKs\TypeScript.
Set TypeScriptToolsVersion to the highest version installed.
In my case I had folders "1.0", "1.7", "1.8", so I set TypeScriptToolsVersion = 1.8, and if you run tsc - v inside that folder you will get 1.8.3 or something, however, when u run tsc outside that folder, it will use PATH variable pointing to TS version installed by NPM, which is in my case 1.8.10.
I believe TS for VS will always be a little behind the latest version of TS you install using NPM. But as far as I understand, VS doesnt know anything about TS installed by NPM, it only targets whateve versions installed by TS for VS extensions, and the version specified in TypeScriptToolsVersion in your project file.
I have VS2015 and I have to run a build with TypeScript 1.7, although I have 1.8 installed via npm install typescript -g there are two ways (at least for me they worked):
Go to your .proj file and add <TypeScriptToolsVersion>1.7</TypeScriptToolsVersion> as up as possible. Rebuild, re-run. If it doesn't work try 2.
Go to Control Panel -> System -> Advanced System Settings -> Enviroment Variables. Make sure you add your desired TypeScript version first: C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.7;C:\Users\serban\AppData\Roaming\npm
This will also affect your CLI:
$ tsc -v
message TS6029: Version 1.7.5
First, make sure you have the following address in your Environment Variables Path
C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0
Then open your Command Prompt and type the following command:
tsc -v
You can do npm list | grep typescript if it's installed through npm.
Open a (normal, not the VS) command prompt or a PowerShell prompt.
tsc.exe -v
tsc.cmd -v
tsc -v
If you installed the same version of TypeScript for Visual Studio and using npm, the output from the above three commands should be the same.
If not, check your System PATH to see where in the path hierarchy and which typescript directory is listed. For PowerShell users, the easy way is:
$env:path -split ';'
Be careful of having nothing or multiple TypeScript directories listed in your System PATH variable. As of June 9, 2017, my System PATH looked like this (just the top part, which is all that matters in this situation):
ps>$env:path -split ';'
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.3
C:\nodejs\
C:\Users\{username}\AppData\Roaming\npm
Notice that only the 2.3 directory is included in the PATH, not multiple versions.
In the command prompt, simply type 1 of the following command then hit Enter :
tsc -v
or
tsc -version
or
tsc --version
Note: Make sure you have added Typescript to environment variable path
before running command, details here: How to set environment
variable.
For a non-commandline approach, you can open the Extensions & Updates window (Tools->Extensions and Updates) and search for the Typescript for Microsoft Visual Studio extension under Installed
If you'd like to find out what version of Typescript is being used on a particular project, go to your package-lock.json file. You will find something like this:
"typescript": {
"version": "3.5.3"
}
As of Visual Studio 2022, there is a new TypeScript/JavaScript project type for Angular/React/Vue, the TypeScript SDK is deprecated (but still installable through the VS installer with warnings), and Visual Studio supposedly provides IntelliSense and language support based on the TypeScript version you're using for your project (npm is the preferred way to specify the version of TypeScript you're using, via your package.json file).
Per this answer, though, there are still questions about how to control/discern what specific TypeScript language version Visual Studio 2022 is supporting at any given moment.

Resources