Fixing VS2017 Typescript build error

Written by Mathew Grabau -

Fixing Visual Studio Typescript errors

After creating a new Typescriptr project in VS and trying to build it, the following error was constantly displayed:

"Build:Cannot find type definition file for 'angular'." (and then another few hundred of the same except with other packages).

After reading the documentation for Typescript, the following addition to tsconfig.json fixed the problem:

    "compilerOptions": {
// ... leaving out a bunch of the options here. The following options must be added.
        "typeRoots": [

The paths specified under typeRoots are the ones applicable to the express project that I had generated.

For reference, the TypeScript version was configured as 2.3.

Fixing dotnet-aspnet-codegenerator error

Written by Mathew Grabau -

After reading the instructions just a bit closer, I finally solved the problems with ASP.NET Core Scaffolding. The Scaffolding feature initializes after first right-clicking on Controllers, then navigating to and clicking Add->Controller. Once the dialog was filled out (for example, with "CompanyController") it would fail with an an error

There was an error running the selected code generator: 'No executable found matching command "dotnet-aspnet-codegenerator"'

This was also affecting Razor Views. The solution is in the first step shown in ScaffoldingReadMe.txt (opens after the scaffolding is added):

  1. Add Scaffolding CLI tool to the project's .csproj file:

    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />