Skip to content

Build Instructions

Dina Berry edited this page Aug 3, 2015 · 38 revisions

To build NTVS on your own PC, for example to pick up the latest bug fixes, make modifications, or contribute back to the project, please use the following instructions.

Cloning

First, you will require a local copy of our Git repository. It can be cloned from https://github.com/Microsoft/nodejstools.git

If you do not want to use Git, you can download the latest commit as a ZIP file from the GitHub page.

If you intend to contribute back to NTVS, you will need to Create a Fork and use the source URL provided there.

Prerequisites

The following list of software is required in order to build NTVS from source. All of these are required for a complete build, though a complete build is not required to be able to contribute. The next section outlines the projects that may be omitted when building NTVS.

Note that you do not all versions of Visual Studio. You'll need VS 2015 to build NTVS for VS 2015, and VS 2013 to build NTVS for VS 2013. Instructions in this document describe how to build using VS 2015 -- building with older versions is similar.

Software

Download

Microsoft Visual Studio Community

Download here.

Include the option feature, Visual Studio Extensibility Tools, during installation. you can find them under Features / Common Tools / Visual Studio Extensibility Tools.

And just a few more steps...

  • You'll need to disable strong name verification for the Node.js Tools binaries. This can be done by merging the Nodejs\Prerequisites\EnableSkipVerification.reg file (or Nodejs\Prerequisites\EnableSkipVerificationX86.reg, depending on your own system). This will install registry keys which disable strong name verification for the assemblies built by NTVS. If you also want to use the installer you may need to stop and restart the Windows Installer service (from an elevated command prompt, type net stop "Windows Installer" and then net start "Windows Installer").
  • Copy Microsoft.NodejsTools.targets from Nodejs\Product\Nodejs to "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\{VS VERSION}\Node.js Tools"
  • If you already have NTVS installed for all users then you will get an error while compiling. The solution is to uninstall NTVS, or to reinstall it for the current user only. To install for the current user, install from the command line using msiexec /i NodejsToolsInstaller.msi ALLUSERS=""
  • Our automated tests use a separately installed tool for controlling Visual Studio. These can be installed by running Common\Tests\Prerequisites\VSTestHost.msi for each version of Visual Studio. Additionally, be sure to update Visual Studio's test settings to point to Build\default.{VS VERSION}Exp.testsettings

Building with Visual Studio

NodejsTools.sln* can be opened and built in Visual Studio using the Build Solution command. To debug, ensure that NodejsTools is selected as the startup project and use F5 to run NTVS inside of the VS Experimental hive. If an error appears rather than a new instance of VS, ensure the Project|Debug settings are correct.

Building in Visual Studio may produce a number of warnings related to potentially incompatible assemblies and missing references. As long as all projects build successfully, these warnings are benign and can be ignored.

Building with MSBuild

NTVS can be built from the Visual Studio Command Prompt by typing

msbuild NodejsTools.sln

in your cloned directory. This will install NTVS into the VS Experimental hive, but does not create an installer or affect your main VS installation. Building should complete with zero warnings or errors.

To build using the Release configuration, which produces optimized code, type:

msbuild NodejsTools.sln /p:Configuration=Release

in the cloned directory. As above, this does not create an .msi file, but it will install NTVS into the VS Experimental hive.

The VS Experimental hive can be started from the Start menu or by typing

devenv /rootSuffix Exp

at the Visual Studio Command Prompt.

Building the Installer

The simplest way to build the installer is to run the release script Nodejs\Setup\BuildRelease.ps1 with PowerShell 3. This script updates the version to the current date, builds all flavors (Release, Debug) for each supported version of Visual Studio installed (currently VS 2015 and VS 2013), and archives the source code, binaries, symbols, and installers into an output directory.

powershell -ExecutionPolicy RemoteSigned .\BuildRelease.ps1 D:\NTVS_Out -skiptests

The output directory will contain VS 201x\Debug and VS 201x\Release folders (for each installed VS version) and a Sources folder. The Debug and Release directories will contain the installers, and the top level will contain all the release installers. This is the same script which we use to builds releases of NTVS, so you'll get an installer which works just like the released versions. However, unless you sign the binaries with your own code signing certificate, the installer will only work if the EnableSkipVerification.reg (or EnableSkipVerificationX86.reg) file has been merged into the registry on the destination computer.

To build NTVS for Visual Studio 2010 or Visual Studio 2012, you should provide the -vstarget 10.0 or -vstarget 11.0 options, as these versions are now disabled by default. You are also likely to encounter build errors, and we are no longer testing changes against these versions.

The script provides many more options. Type powershell -ExecutionPolicy RemoteSigned Get-Help .\BuildRelease.ps1 for more information and **powershell -ExecutionPolicy RemoteSigned Get-Help .\BuildRelease.ps1 -examples for some examples.

Clone this wiki locally