Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 7d142c1

Browse files
DeborahKwardbell
authored andcommitted
docs(vs2015): update for current tools. (#2672)
closes #2672
1 parent 2408bb1 commit 7d142c1

File tree

1 file changed

+80
-73
lines changed

1 file changed

+80
-73
lines changed

public/docs/ts/latest/cookbook/visual-studio-2015.jade

+80-73
Original file line numberDiff line numberDiff line change
@@ -5,63 +5,101 @@ include ../_util-fns
55
Some developers prefer Visual Studio as their Integrated Development Environment (IDE).
66

77
This cookbook describes the steps required to set up and use the
8-
Angular QuickStart files in Visual Studio 2015 within an ASP.NET 4.x project.
9-
8+
Angular QuickStart files in **Visual Studio 2015 within an ASP.NET 4.x project**.
109
.l-sub-section
1110
:marked
1211
There is no *live example* for this cookbook because it describes Visual Studio, not the application.
12+
1313
.l-main-section
1414
<a id="asp-net-4"></a>
1515
:marked
1616
## ASP.NET 4.x Project
17-
18-
The steps for setting up the QuickStart files with an ASP.NET 4.x project in
19-
Visual Studio 2015 are as follows:
17+
18+
This cookbook explains how to set up the QuickStart files with an **ASP.NET 4.x project** in
19+
Visual Studio 2015.
20+
.l-sub-section
21+
:marked
22+
If you prefer a `File | New Project` experience and are using **ASP.NET Core**,
23+
then consider the _experimental_
24+
<a href="http://blog.stevensanderson.com/2016/10/04/angular2-template-for-visual-studio/" target="_blank">ASP.NET Core + Angular 2 template for Visual Studio 2015</a>.
25+
Note that the resulting code does not map to the docs. Adjust accordingly.
2026

2127
:marked
22-
- [Prerequisite](#prereq): Install Node.js
28+
The steps are as follows:
29+
30+
- [Prerequisite](#prereq1): Install Node.js
31+
- [Prerequisite](#prereq2): Install Visual Studio 2015 Update 3
32+
- [Prerequisite](#prereq3): Configure External Web tools
33+
- [Prerequisite](#prereq4): Install TypeScript 2 for Visual Studio 2015
2334
- [Step 1](#download): Download the QuickStart files
24-
- [Step 2](#setup-vs): Set up Visual Studio for TypeScript
25-
- [Step 3](#create-project): Create the Visual Studio ASP.NET project
26-
- [Step 4](#copy): Copy the QuickStart files into the ASP.NET project folder
27-
- [Step 5](#restore): Restore required packages
28-
- [Step 6](#edit-config): Edit the TypeScript configuration file
29-
- [Step 7](#build-and-run): Build and run the app
35+
- [Step 2](#create-project): Create the Visual Studio ASP.NET project
36+
- [Step 3](#copy): Copy the QuickStart files into the ASP.NET project folder
37+
- [Step 4](#restore): Restore required packages
38+
- [Step 5](#build-and-run): Build and run the app
3039

3140
.l-main-section
32-
h2#prereq Prerequisite: Node.js
41+
h2#prereq1 Prerequisite: Node.js
3342
:marked
3443
Install **[Node.js® and npm](https://nodejs.org/en/download/)**
3544
if they are not already on your machine.
3645
.l-sub-section
3746
:marked
38-
**Verify that you are running node version `4.4.x` - `5.x.x`, and npm `3.x.x`**
47+
**Verify that you are running node version `4.6.x` or greater, and npm `3.x.x` or greater**
3948
by running `node -v` and `npm -v` in a terminal/console window.
4049
Older versions produce errors.
4150

4251
.l-main-section
43-
h2#download Step 1: Download the QuickStart files
52+
h2#prereq2 Prerequisite: Visual Studio 2015 Update 3
4453
:marked
45-
[Download the QuickStart source](https://github.com/angular/quickstart)
46-
from github. If you downloaded as a zip file, extract the files.
54+
The minimum requirement for developing Angular 2 applications with Visual Studio is Update 3.
55+
Earlier versions do not follow the best practices for developing applications with TypeScript.
56+
To view your version of Visual Studio 2015, go to `Help | About Visual Studio`.
57+
58+
If you don't have it, install **[Visual Studio 2015 Update 3](https://www.visualstudio.com/en-us/news/releasenotes/vs2015-update3-vs)**.
59+
Or use `Tools | Extensions and Updates` to update to Update 3 directly from Visual Studio 2015.
4760

4861
.l-main-section
49-
h2#setup-vs Step 2: Set up Visual Studio for TypeScript
62+
h2#prereq3 Prerequisite: Configure External Web tools
5063
:marked
51-
Ensure you have the latest version of Visual Studio 2015 installed.
52-
Then open Visual Studio and install the latest set of TypeScript tools as follows:
64+
Configure Visual Studio to use the global external web tools instead of the tools that ship with Visual Studio:
5365

54-
* Open `Tools` | `Extensions and Updates`.
55-
* Select `Online` in the tree on the left.
56-
* Search for `TypeScript` using the search box in the upper right.
57-
* Select the most current available TypeScript version.
58-
* Download and install the package.
66+
* Open the **Options** dialog with `Tools` | `Options`
67+
* In the tree on the left, select `Projects and Solutions` | `External Web Tools`.
68+
* On the right, move the `$(PATH)` entry above the `$(DevEnvDir`) entries. This tells Visual Studio to
69+
use the external tools (such as npm) found in the global path before using its own version of the external tools.
70+
* Click OK to close the dialog.
71+
* Restart Visual Studio for this change to take effect.
72+
73+
Visual Studio will now look first for external tools in the current workspace and
74+
if not found then look in the global path and if it is not found there, Visual Studio
75+
will use its own versions of the tools.
5976

6077
.l-main-section
61-
h2#create-project Step 3: Create the Visual Studio ASP.NET project
78+
h2#prereq4 Prerequisite: Install TypeScript 2 for Visual Studio 2015
79+
:marked
80+
While Visual Studio Update 3 ships with TypeScript support out of the box, it currently doesn’t ship with TypeScript 2,
81+
which you need to develop Angular 2 applications.
82+
83+
To install TypeScript 2:
84+
* Download and install **[TypeScript 2.0 for Visual Studio 2015](http://download.microsoft.com/download/6/D/8/6D8381B0-03C1-4BD2-AE65-30FF0A4C62DA/TS2.0.3-TS-release20-nightly-20160921.1/TypeScript_Dev14Full.exe)**
85+
* OR install it with npm: `npm install -g [email protected]`.
86+
87+
You can find out more about TypeScript 2 support in Visual studio **[here](https://blogs.msdn.microsoft.com/typescript/2016/09/22/announcing-typescript-2-0/)**
88+
89+
At this point, Visual Studio is ready. It’s a good idea to close Visual Studio and
90+
restart it to make sure everything is clean.
6291

92+
.l-main-section
93+
h2#download Step 1: Download the QuickStart files
6394
:marked
64-
Create the ASP.NET 4.x project as follows:
95+
[Download the QuickStart source](https://github.com/angular/quickstart)
96+
from github. If you downloaded as a zip file, extract the files.
97+
98+
.l-main-section
99+
h2#create-project Step 2: Create the Visual Studio ASP.NET project
100+
101+
:marked
102+
Create the ASP.NET 4.x project in the usual way as follows:
65103

66104
* In Visual Studio, select `File` | `New` | `Project` from the menu.
67105
* In the template tree, select `Templates` | `Visual C#` (or `Visual Basic`) | `Web`.
@@ -74,7 +112,7 @@ h2#create-project Step 3: Create the Visual Studio ASP.NET project
74112
no authentication and no hosting. Pick the template and options appropriate for your project.
75113

76114
.l-main-section
77-
h2#copy Step 4: Copy the QuickStart files into the ASP.NET project folder
115+
h2#copy Step 3: Copy the QuickStart files into the ASP.NET project folder
78116

79117
:marked
80118
Copy the QuickStart files we downloaded from github into the folder containing the `.csproj` file.
@@ -90,7 +128,7 @@ h2#copy Step 4: Copy the QuickStart files into the ASP.NET project folder
90128
* tsconfig.json
91129

92130
.l-main-section
93-
h2#restore Step 5: Restore the required packages
131+
h2#restore Step 4: Restore the required packages
94132
:marked
95133
Restore the packages required for an Angular application as follows:
96134

@@ -102,60 +140,29 @@ h2#restore Step 5: Restore the required packages
102140
* When the restore is finished, a message should say: `npm command completed with exit code 0`.
103141
* Click the `Refresh` icon in Solution Explorer.
104142
* **Do not** include the `node_modules` folder in the project. Let it be a hidden project folder.
105-
.alert.is-important
106-
:marked
107-
An error such as "*@angular/compiler is not in the npm registry*" suggests that Visual Studio 2015
108-
is using an older version of npm. Update to the latest installed version of npm:
109-
110-
* `Tools` | `Options` to open the Options dialog.
111-
* In the tree on the left, select `Projects and Solutions` | `External Web Tools`.
112-
* On the right, move the `$(PATH)` entry above the `$(DevEnvDir`) entries. This tells Visual Studio to
113-
use the external tools (such as npm) found in your path before using its own version of the external tools.
114-
* Click OK to close the dialog.
115-
* Restart Visual Studio for this change to take effect.
116-
117-
.l-main-section
118-
h2#edit-config Step 6: Edit the TypeScript configuration file
119-
:marked
120-
For Visual Studio 2015 we must add `"compileOnSave": true` to the TypeScript configuration (`tsconfig.json`) file
121-
as shown here.
122-
123-
+makeJson('cb-visual-studio-2015/ts/tsconfig.json', null, 'tsconfig.json (scripts)')
124-
125-
:marked
126-
After making this change, **exit** Visual Studio and reopen it to reload the project.
127143

128144
.l-main-section
129-
h2#build-and-run Step 7: Build and run the app
145+
h2#build-and-run Step 5: Build and run the app
130146

131147
:marked
132-
To set index.html as start page, right-click `index.html` in Solution Explorer and select option `Set As Start Page`.
133-
134-
Click the Run button or press F5 to build and run the application.
148+
First, ensure that `index.html` is set as the start page.
149+
Right-click `index.html` in Solution Explorer and select option `Set As Start Page`.
135150

136-
This launches the default browser and runs the QuickStart sample application.
151+
Build and launch the app with debugger by clicking the **Run** button or press `F5`.
152+
.l-sub-section
153+
:marked
154+
It's faster to run without the debugger by pressing `Ctrl-F5`.
155+
:marked
156+
The default browser opens and displays the QuickStart sample application.
137157

138158
Try editing any of the project files. *Save* and refresh the browser to
139159
see the changes.
140160

141-
.alert.is-important
142-
:marked
143-
Compiler errors such as "*Property `map` does not exist on type `Observable<Response>`*" and
144-
"*Observable cannot be found*" indicate an old release of Visual Studio.
145-
Exit Visual Studio and follow the [instructions here](https://github.com/Microsoft/TypeScript/issues/8518).
146-
147-
You'll be asked to replace the file
148-
code-example.
149-
c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript.typescriptServices.js
150-
151-
:marked
152-
This operation requires admin privileges.
153-
154161
.l-main-section
155162
h2#routing Note on Routing Applications
156163
:marked
157164
If this application used the Angular router, a browser refresh could return a *404 - Page Not Found*.
158-
Look at the address bar. Does it contain a navigation url (a "deep link")?
159-
We'll have to configure the server to return `index.html` for these requests.
160-
Until we do, remove the navigation path and refresh again.
161-
165+
Look at the address bar. Does it contain a navigation url (a "deep link") ... any path other than `/` or `/index.html`?
166+
167+
You'll have to configure the server to return `index.html` for these requests.
168+
Until you do, remove the navigation path and refresh again.

0 commit comments

Comments
 (0)