Document your code
Every project on GitHub comes with a version-controlled wiki to give your documentation the high level of care it deserves. It’s easy to create well-maintained, Markdown or rich text documentation alongside your code.
Sign up for free See pricing for teams and enterprisesBuild Instructions for PTVS
PTVS is an open-source project, and our intent is for others to be able to easily obtain, modify and rebuild the sources. This page provides the instructions necessary
Cloning
First, you will require a local copy of our Git repository. It can be cloned from https://github.com/Microsoft/PTVS.git. (If you're behind a corporate firewall you may need to enter your proxy settings.)
If you intend to contribute back to PTVS, you should Create a Fork and use the source URL provided there. Pull requests associated with an issue or feature request are the preferred way for making contributions.
Prerequisites
To build PTVS, you will need the latest Visual Studio 2017 Preview Community edition or higher. When you install, select the Visual Studio extension development workload (near the bottom) and also the Visual Studio C++ core features and VC++ 2017 v141 toolset items that will appear on the right-hand side. Finally, in order to build Django support, you should select the ASP.NET and web development workload. Installing Python support may interfere with your build, so do not select it.
In order to run UI tests, you will also need the latest VSTestHost. See the instructions there for installation. This is no longer required - our UI test "framework" is now integrated into our build, so it will Just Work(TM).
Other prerequisites are downloaded and installed by running the Build\PreBuild.ps1 script. This may be run automatically on first build, in which case you will need to restart the build.
Finally you'll need to disable strong name verification for the built binaries. This can be done by merging the Python\Prerequisites\EnableSkipVerification.reg file (or Python\Prerequisites\EnableSkipVerificationX86.reg, if you are running a 32-bit OS). This will install registry keys which disable strong name verification for the assemblies built by PTVS.
Note: it is currently not possible to build an installer because we rely on Microsoft-internal tools. As time allows we will migrate to publicly available VSIX tools.
Optional Projects
Core projects are always required to be built, and you will receive build errors if you unload one by mistake. They are grouped under the "CoreProduct" solution folder. The PythonTools.sln solution file includes a solution platform called "Minimal" that may be selected within Visual Studio to only build these projects. This will give the fastest possible build times, while only providing core functionality.
Projects under the "Product" solution folder are optional and may be unloaded to reduce build time. Once they are built, you should Clean the solution before unloading them. Note that some of the tests require these projects.
Projects under the "Tests" solution folder are also optional, but as we expect tests to be added or fixed for contributions you will likely need to run some of them. We do not require 100% test pass rate to accept a pull request, as there are a number of tests that rely on precise system configuration or are known to be unreliable.
Building with MSBuild
PTVS can be built from the Visual Studio Command Prompt by typing
msbuild Python\dirs.proj
in your cloned directory. This will not install PTVS into the VS Experimental hive, 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 Python\dirs.proj /p:Configuration=Release
in the cloned directory. As above, this does not create an .msi file or install PTVS into the VS Experimental hive.
To build and deploy to the Experimental hive from the command line, add the following properties:
msbuild Python\dirs.proj /p:DeployExtension=true /p:RegisterOutputPackage=true
The VS Experimental hive can be started from the Start menu or by typing
devenv /rootSuffix Exp
at the Visual Studio Command Prompt.
Building with Visual Studio
PythonTools.sln can be opened and built in Visual Studio using the Build Solution command. To debug, ensure that Core is selected as the startup project and use F5 to run PTVS inside of the VS Experimental hive. If an error appears rather than a new instance of VS, ensure the Project|Debug settings are correctly starting your devenv.exe with arguments /rootSuffix Exp (and optionally /log).
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.
Loading projects in experimental hive
In order to load Python projects successfully in the experimental hive, you'll need to deploy the .targets files to your Visual Studio install location.
The files to copy are located in the PTVS\Python\Product\BuildTasks\TestTargets folder, and must be copied to the <vsinstalldir>\MSBuild\Microsoft\VisualStudio\v15.0\Python Tools folder.
We have a helper script Python\Prerequisites\deploy_test_targets.cmd that may work for you, depending on where you've installed Visual Studio (it tries to guess some locations).
Running Automated Tests
PTVS contains a large number of automated tests, including a mix of UI-based tests (which will start another VS, take control of your mouse, etc.) and non-UI tests. Some of the UI-based tests may fail intermittently or interfere with each other, while some tests may make incorrect assumptions about your system configuration (such as the availability of certain versions of Python). It is best to select the tests you need from the Test Explorer window and supervise them as they run.


