!Note -> 📌
!Warning -> ⚠️
!Caution -> ⚠️
This commit is contained in:
Andrew Casey 2019-03-01 16:04:54 -08:00
Родитель 14301742e3
Коммит 0a454c6c65
12 изменённых файлов: 54 добавлений и 54 удалений

Просмотреть файл

@ -12,11 +12,11 @@ uid: tsnuget
As an alternative to using the TypeScript SDK with MSBuild to compile TypeScript, you can also use the TypeScript NuGet package `Microsoft.TypeScript.MSBuild`. This allows you to install a particular version of TypeScript locally to your project.
> [!NOTE]
> :pushpin:
> One common use case for the NuGet package is for compiling TypeScript using the .NET Core CLI. Unless you are willing to hand-edit your project file to import build targets from a TypeScript SDK installation, the NuGet package is the only way to enable TypeScript compilation using .NET Core CLI commands such as `dotnet build` and `dotnet publish`.
>[!CAUTION]
> If you are using the NuGet package for MSBuild support for a given project, that project file must not itself import `Microsoft.TypeScript.Default.props` or `Microsoft.TypeScript.targets`.
>:warning:
> If you are using the NuGet package for MSBuild support for a given project, that project file must not itself import `Microsoft.TypeScript.Default.props` or `Microsoft.TypeScript.targets`.
> These will be imported by the NuGet package, so including them separately could cause unintended behavior. See [Removing Default Imports](#removing-default-imports) for details on what to remove.
## Installing major releases via NuGet (https://www.nuget.org)
@ -31,7 +31,7 @@ As an alternative to using the TypeScript SDK with MSBuild to compile TypeScript
## Installing nightly drops (https://www.myget.org)
1. Add a new Package Source
1. Add a new Package Source
* Go to `Tools` -> `Options` -> `NuGet Package Manager` -> `Package Sources`
* Create a new Source:
* Name: `TypeScript Nightly`
@ -42,7 +42,7 @@ As an alternative to using the TypeScript SDK with MSBuild to compile TypeScript
2. Use the new Package Source
* On Project node Right-Click -> `Manage NuGet Packages`
* Search for `Microsoft.TypeScript.MSBuild`
<img src="../../images/mygetMSBuild.PNG" width="700px" alt="Search for NuGet Nightly Build Package"/>
* Hit `Install`
@ -92,7 +92,7 @@ As an alternative to using the TypeScript SDK with MSBuild to compile TypeScript
This file imports `Microsoft.TypeScript.Default.props` from the `tools` folder and sets properties indicating that the build has been initiated through NuGet.
* `tools` folder
Versions prior to 2.3 only contain a tsc folder. `Microsoft.TypeScript.targets` and `TypeScript.Tasks.dll` are located at the root level.
In versions 2.3 and later, the root level contains `Microsoft.TypeScript.targets` and `Microsoft.TypeScript.Default.props`. See [MSBuild Configuration](xref:msbuild) for more details on these files.
@ -111,7 +111,7 @@ As an alternative to using the TypeScript SDK with MSBuild to compile TypeScript
3. `tsc`
This folder contains `tsc.js`, `tsserver.js` and all dependency files required to run them as node scripts.
> [!NOTE]
> :pushpin:
> If Visual Studio is installed then the `node.exe` bundled with it will automatically be picked up. Otherwise Node.js must be installed on the machine.
Versions prior to 3.1 contained a `tsc.exe` executable to run the compilation. In version 3.1 this was removed in favor of using `node.exe`.

Просмотреть файл

@ -14,7 +14,7 @@ uid: msbuild
There are two different sources of information that tell MSBuild how to handle TypeScript. The first, `Microsoft.TypeScript.Default.props`, establishes some default TypeScript compilation settings. The second, `Microsoft.TypeScript.targets`, gives instructions on how to handle TypeScript files as part of the building and cleaning processes. To include these in your project, you will need to (in most cases) import `Microsoft.TypeScript.Default.props` at the beginning of your project file and `Microsoft.TypeScript.targets` at the end, as shown [in the TypeScript handbook](http://www.typescriptlang.org/docs/handbook/integrating-with-build-tools.html#msbuild).
> [!NOTE]
> :pushpin:
> ASP.NET Core projects implicitly include these files, so an ASP.NET Core project file will not need to import them.
## The `TypeScriptToolsVersion` property
@ -26,7 +26,7 @@ Since a particular machine may have multiple versions of TypeScript installed, M
## Input files
There are two ways of including TypeScript files in the compilation: either using a tsconfig.json file or the `TypeScriptCompile` MSBuild item type.
### With TSConfig
One option for allowing MSBuild to recognize what TypeScript files are part of your project is by way of a tsconfig.json file. This configuration file can either be explicitly associated with your .csproj in the Content item list, as shown in the example below, or it can be simply included as part of the directory tree rooted at the directory containing your project file.
One option for allowing MSBuild to recognize what TypeScript files are part of your project is by way of a tsconfig.json file. This configuration file can either be explicitly associated with your .csproj in the Content item list, as shown in the example below, or it can be simply included as part of the directory tree rooted at the directory containing your project file.
```xml
<ItemGroup>
<Content Include="myfolder/tsconfig.json" />

Просмотреть файл

@ -2,7 +2,7 @@
Visual Studio has the capability to use and generate source maps on JavaScript source files. This is often required if your source is minified or created by a transpiler like TypeScript. By default it will generate it for you.
> [!NOTE]
> :pushpin:
> We're going to assume you already know about source maps. If not, we suggest to read the page [Introduction to JavaScript Source Maps](https://www.html5rocks.com/en/tutorials/developertools/sourcemaps/).
See below if you'll like to know how to configure more advance settings. You can use either a tsconfig.json or the project settings, but not both.

Просмотреть файл

@ -1,6 +1,6 @@
# Intellisense
> [!NOTE]
> :pushpin:
> Cover using .d.ts files to fund intellisense.
Intellisense is a broad topic. Let's get started...

Просмотреть файл

@ -27,17 +27,17 @@ As mentioned above, by default, ESLint will provide results based on the global
Visual Studio will use its installation of ESLint 4 by default. However, if you would like to use a different version, Visual Studio will pick up a local installation of ESLint and use it instead. In particular, if any parent directory of the file you want to be linted contains a `package.json` that lists ESLint as a dependency, as well as a `node_modules` folder with an installation of ESLint, then it will use that copy of the linter. Visual Studio is designed to be backwards compatible to ESLint 2.
> [!WARNING]
> :warning:
> Before version 4, ESLint did not provide full location information for its results. Therefore, if you are using a version of ESLint earlier than 4, squiggles will appear under the first character of any error location, rather than underneath the whole error.
#### Configuring files to be ignored
Since Visual Studio now lints all files in your project or solution, you may want to choose some files or directories for it to ignore. To do so, Visual Studio supports the `.eslintignore` file. When such a file is located in a project's root directory, ESLint will use it to exclude the requested files or directories from linting. More information on usage of the `.eslintignore` file can be found in [the ESLint documentation](https://eslint.org/docs/user-guide/configuring#ignoring-files-and-directories).
> [!NOTE]
> :pushpin:
> When using a `jsconfig.json` file, or when using a `tsconfig.json` file with `allowJS` enabled, the location of that file is considered to be the project root. Otherwise, the location of the project file (e.g., a `.csproj` file) is considered to be the project root. In scenarios without such a file, such as when using Open Folder or when the rooting `tsconfig.json` does not have `allowJS` enabled, an `.eslintignore` file in the User Home folder will be recognized.
> [!NOTE]
> :pushpin:
> Since ASP.NET Core projects frequently include JavaScript libraries in the `wwwroot\lib` directory, files in that directory will not be linted by default. If you do want these files to be linted, you can re-include that directory or any file or subdirectory it contains by using an `.eslintignore` file.
### Settings

Просмотреть файл

@ -33,7 +33,7 @@ Debugging runs `node_modules\@vue\cli-service\bin\vue-cli-service.js serve`. You
Vue.js provides an official CLI for quickly scaffolding projects. If you would like to use it to create your application, follow the steps below to setup your development environment.
> [!NOTE]
> :pushpin:
> This steps assumes you already have some knowledge about the Vue.js framework. If not, we suggest to visit [Vue.js](https://vuejs.org/) for details about it.
### Create a new ASP.NET Core project

Просмотреть файл

@ -35,7 +35,7 @@ The details for each of these tasks follows.
To set up GitHub for Visual Studio:
1. Make sure the [GitHub Extension for Visual Studio](https://visualstudio.github.com/) is installed and enabled using the
1. Make sure the [GitHub Extension for Visual Studio](https://visualstudio.github.com/) is installed and enabled using the
menu item **Tools** > **Extensions and Updates**.
2. From the menu select **View** > **Other Windows** > **GitHub**, and the following appears.
@ -73,7 +73,7 @@ The next steps show you how to publish from this repository to an Azure App Serv
<img width="575px" src="../../images/linux-appservice/script-generator-args.png"/>
> [!WARNING]
> :warning:
> The App Service deployment process uses a set of heuristics to determine which type of application to try and run. If a **.sln** file is detected in the deployed content, it will assume an MSBuild based project is being deployed. The setting added above overrides this logic and specifies explicitly that this is a Node.js application. Without this setting, the Node.js application will fail to deploy if the *.sln* file is part of the repository being deployed to the App Service.
7. Once created, open the App Service and select **Deployment options**.
@ -117,7 +117,7 @@ and it is accessible at the URL created for the Azure App Service (by default th
* If the node.exe process dies (that is, an unhandled exception occurs), the container restarts.
* When the container starts up, it runs through various heuristics to figure out
how to start the Node.js process. Details of the implementation can be seen at
how to start the Node.js process. Details of the implementation can be seen at
[generateStartupCommand.js](https://github.com/Azure-App-Service/node/blob/master/8.9.4/startup/generateStartupCommand.js).
* You can connect to the running container via SSH for investigations. This is easily done using the Azure Portal. Select the App Service, and scroll down
the list of tools until reaching **SSH** under the **Development Tools** section.

Просмотреть файл

@ -1,13 +1,13 @@
# Node.js requirements
To install support for developing Node.js application in Visual Studio 2017, follow the instructions for selecting the Node.js workload in the Visual Studio 2017 installer, and downloading and installing the
To install support for developing Node.js application in Visual Studio 2017, follow the instructions for selecting the Node.js workload in the Visual Studio 2017 installer, and downloading and installing the
Node.js runtime.
To quickly test the Node.js support after following the installation steps, open the Node.js Interactive
To quickly test the Node.js support after following the installation steps, open the Node.js Interactive
Window by pressing Alt-K,N and entering `2+2`. If you don't see the output of `4`, recheck your steps.
For details, see [Using the Interactive Window](interactivewindow.md).
> [!Note]
> :pushpin:
> Node.js support is not presently available in Visual Studio for Mac, but is available on Mac and Linux
through Visual Studio Code.
@ -20,7 +20,7 @@ through Visual Studio Code.
(https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15&utm_source=docs&utm_medium=clickbutton)
>[!Tip]
> The Community edition is for individual developers, classroom learning, academic research, and open source development. For other uses, install [Visual Studio 2017 Professional](https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Professional&rel=15&utm_source=docs&utm_medium=clickbutton)
> The Community edition is for individual developers, classroom learning, academic research, and open source development. For other uses, install [Visual Studio 2017 Professional](https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Professional&rel=15&utm_source=docs&utm_medium=clickbutton)
or [Visual Studio 2017 Enterprise](https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Enterprise&rel=15&utm_source=docs&utm_medium=clickbutton).
1. The installer presents you with a list of workloads, which are groups of related options for specific development areas. For Node.js, select the **Node.js** workload.
@ -31,7 +31,7 @@ through Visual Studio Code.
![Node.js development options in the Visual Studio installer](../../images/node/installation-nodejs-options.png)
| Option | Description |
| Option | Description |
| --- | --- |
| Connectivity and publishing tools | Publishing to Azure ?? |
| Developer Analytics tools | No idea ?? |
@ -44,11 +44,11 @@ through Visual Studio Code.
## Installing the Node.js runtime
Node.js support doesn't come with a Node.js Runtime, so you need to install a version from the
[Node.js website](https://nodejs.org/en/download/). In general, Visual Studio automatically detects the
Node.js support doesn't come with a Node.js Runtime, so you need to install a version from the
[Node.js website](https://nodejs.org/en/download/). In general, Visual Studio automatically detects the
installed Node.js runtime, if it does not detect an installed runtime you can configure your project
to reference the installed runtime.
>[!Tip]
>Although Visual Studio 2017 does support older versions, we recommend you install at least the
current LTS Version.
>Although Visual Studio 2017 does support older versions, we recommend you install at least the
current LTS Version.

Просмотреть файл

@ -9,11 +9,11 @@ The supported frameworks are:
* Tape ([github.com/substack/tape](https://github.com/substack/tape))
* Export Runner (a Node.js tools specific framework)
> [!Warning]
> :warning:
> An issue in Tape currently prevents Tape tests from running.
> If [this PR](https://github.com/substack/tape/pull/361) is merged, the issue should be resolved.
If your favorite framework is not supported, see [Add support for a unit test framework](#addingFramework) for information on adding support.
If your favorite framework is not supported, see [Add support for a unit test framework](#addingFramework) for information on adding support.
## Write unit tests
@ -55,7 +55,7 @@ displayed. If tests are not showing initially, then rebuild the project to refre
![Test Explorer](../../images/node/UnitTestsDiscoveryMocha.png)
> [!NOTE]
> :pushpin:
> Do not use the `outdir` or `outfile` option in *tsconfig.json*, because Test Explorer won't be able to find your unit tests in TypeScript files.
## Run tests
@ -66,7 +66,7 @@ You can run tests in Visual Studio 2017 or from the command line.
You can run the tests by clicking the **Run All** link in the Test Explorer window. Or, you can run tests by selecting one or more tests or groups, right-clicking, and selecting **Run Selected Tests** from the shorcut menu. Tests run in the background, and Test Explorer automatically updates and shows the results. Further, you can also debug selected tests by selecting **Debug Selected Tests**.
> [!NOTE]
> :pushpin:
> We don't currently support profiling tests, or code coverage.
### Run tests from the command line
@ -105,13 +105,13 @@ Test Run Failed.
Test execution time: 1.5731 Seconds
```
> [!NOTE]
> If you get an error indicating that *vstest.console.exe* cannot be found, make sure you've opened the Developer Command Prompt and not a regular command prompt.
> :pushpin:
> If you get an error indicating that *vstest.console.exe* cannot be found, make sure you've opened the Developer Command Prompt and not a regular command prompt.
## <a name="addingFramework"></a>Add support for a unit test framework
You can extend the support for additional test frameworks by implementing the discovery and execution logic using JavaScript. In the following location:
*<VisualStudioFolder>\Common7\IDE\Extensions\Microsoft\NodeJsTools\TestAdapter\TestFrameworks*
You see folders for the supported test frameworks. Under each folder, a JavaScript file named after the folder contains two exported functions:

Просмотреть файл

@ -1,6 +1,6 @@
# Open Folder projects in JavaScript and TypeScript
# Open Folder projects in JavaScript and TypeScript
Visual Studio 2017 introduces the ability to [develop code without projects or solutions](https://docs.microsoft.com/en-us/visualstudio/ide/develop-code-in-visual-studio-without-projects-or-solutions),
Visual Studio 2017 introduces the ability to [develop code without projects or solutions](https://docs.microsoft.com/en-us/visualstudio/ide/develop-code-in-visual-studio-without-projects-or-solutions),
which enables you to open a folder of code and immediately start working with rich editor support such as IntelliSense, search, refactoring, debugging, and more.
In addition to these features, the Node Tools workload adds support
for building TypeScript files, managing npm packages, and running npm scripts.
@ -11,21 +11,21 @@ In the background, Visual Studio will index the files to enable the npm, build,
## npm Integration
If the folder you opened contains a `package.json` file, right-clicking that file will show a npm specific context menu item.
If the folder you opened contains a `package.json` file, right-clicking that file will show a npm specific context menu item.
![npm menu in solution explorer](../../images/node/solution-explorer-npm-ctx.png)
![npm menu in solution explorer](../../images/node/solution-explorer-npm-ctx.png)
In the menu you can manage the packages installed by npm in the same way you
In the menu you can manage the packages installed by npm in the same way you
[manage npm packages](../nodejs/npm.md) when using a project file.
In addition the menu also allows you to run scripts defined in the scripts element in `package.json`.
These scripts will use the version of Node.js available on the `PATH`, and run in a new window.
These scripts will use the version of Node.js available on the `PATH`, and run in a new window.
This is a great way to execute build or run scripts.
## Build and Debug
### package.json
If the `package.json` in the folder specifies a `main` element, `Debug` will be available in the right click context menu.
If the `package.json` in the folder specifies a `main` element, `Debug` will be available in the right click context menu.
Clicking this will start `node.exe` with the specified script as its argument.
### JavaScript files
@ -34,14 +34,14 @@ JavaScript files can be debugged by right-clicking them, and selecting `Debug` f
### TypeScript files and tsconfig.json
If there is no `tsconfig.json` present in the folder, right-clicking a TypeScript file will you give you the option to build and debug that file using `tsc.exe` with default options. (You need to build the file before you can debug.)
> [!Note]
> For building TypeScript code we use the newest version installed in
> :pushpin:
> For building TypeScript code we use the newest version installed in
`C:\Program Files (x86)\Microsoft SDKs\TypeScript`
If there is a `tsconfig.json` file present in the folder, right-clicking a TypeScript file will give you the option to debug that TypeScript file, only if there is no `outFile` specified.
If an `outFile` is specified, you can debug that file by right-clicking on the `tsconfig.json` file.
If there is a `tsconfig.json` file present in the folder, right-clicking a TypeScript file will give you the option to debug that TypeScript file, only if there is no `outFile` specified.
If an `outFile` is specified, you can debug that file by right-clicking on the `tsconfig.json` file.
The `tsconfig.json` file will also give you a build option to allow you specify compiler options.
> [!Note]
> More information about `tsconfig.json` can be found in the
> :pushpin:
> More information about `tsconfig.json` can be found in the
[tsconfig.json TypeScript Handbook page](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html).

Просмотреть файл

@ -1,6 +1,6 @@
# Editor Problems
> [!NOTE]
> :pushpin:
> This page attempts to explain that the "why" as well as the "how", as investigations are
> often more fruitful when the underlying mechanics and the reason for changes are understood.
> Many of the details below may be skipped over if not useful or interesting.
@ -35,7 +35,7 @@ If the above and below investigations don't help, try repairing Visual Studio. T
Search for `"TypeScript"` and ensure the TypeScript Tools are listed, and are not disabled. Do the same for the
`"Visual Studio extension for TextMate grammars"` (which is used to provide syntax highlighting).
> [!NOTE]
> :pushpin:
> Currently there is also a bug whereby if the `"Azure Functions and Web Jobs Tools"` extension is
> disabled, then this can break the JavaScript & TypeScript language service. Please check this also.

Просмотреть файл

@ -12,16 +12,16 @@ on the command line before launching Visual Studio. Below describes how to do it
2. Set the environment variable with a command such as: `SET TSS_LOG=-level verbose -file C:\temp\logs\tsserver.PID.log`
3. Launch VS 2017 from the same command prompt by running `devenv.exe`.
> [!NOTE]
> :pushpin:
> The folder to contain the log file referenced in step 2 should already exist
> [!NOTE]
> :pushpin:
> If your TypeScript version is less than 3.1, please `Disable dedicated syntax process` under Tools > Options > Text Editor > JavaScript/TypeScript > Language Service and restart Visual Studio
After reproducing the problem, log files should be created in the folder specified. (There will be a `tsserver.<ProcId>.log` file
created for each langauge service process, and a `ti-<ProcId>.log` file created for any types installer processes).
> [!WARNING]
> :warning:
> The log file may contain sensitive information, such as file paths, segments of code, and
> data used for completion lists, signature help, etc. Review the file before sharing if this is a concern.
@ -48,7 +48,7 @@ and allowing the trace to finish packaging. Do not hit Cancel in PerfView, as th
The zip file created contains detailed logging of file access, asynchronous tasks, Visual Studio internal
events, and events from the TypeScript/JavaScript language service.
> [!CAUTION]
> :warning:
> The log file created can be extremely large - in the order of hundreds of megabytes per minute - and
> contains system-wide details including call-stacks, file access, etc. Ensure you have sufficient
> disk space, stop logging promptly after reproducing the problem, and do not share the trace if it may