TheoG
TheoG

Reputation: 1558

How to get angular2 to working in Visual Studio 2015 with TypeScript?

OS: Windows 10 Pro
IDE: Visual Studio 2015 Community

So I've been trying to get the '5 minute quickstart' demo (https://angular.io/guide/quickstart) to work on VS 2015, without success.

I have a package.json file 'included' in my project:

{
  "name": "TypeScriptHTMLApp2",
  "version": "1.0.0",
  "description": "",
  "main": "app.ts",
  "dependencies": {
    "angular2": "2.0.0-alpha.46",
    "systemjs": "0.19.6"
  }
}

and have 'excluded' the 'node_modules' folder, because when included it was generating many duplicate error messages.

But I'm getting error TS2307 'Cannot find module 'angular2/angular2' on the following line:

import {Component, bootstrap} from "angular2/angular2";

How do I resolve this issue so as to make this demo work?

Many thanks in advance

Upvotes: 1

Views: 747

Answers (1)

Chaz Guerrero
Chaz Guerrero

Reputation: 1

you have to unload your project file and add the below line

 <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TypeScriptRemoveComments>false</TypeScriptRemoveComments>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptJSXEmit>None</TypeScriptJSXEmit>
    <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
    <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
    <TypeScriptModuleKind>System</TypeScriptModuleKind>
    <TypeScriptModuleResolution>node</TypeScriptModuleResolution> <!-- THIS LINE -->
    <TypeScriptOutFile />
    <TypeScriptOutDir />
    <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
    <TypeScriptExperimentalDecorators>true</TypeScriptExperimentalDecorators>
    <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
    <TypeScriptMapRoot />
    <TypeScriptSourceRoot />
  </PropertyGroup> 

Upvotes: 0

Related Questions