Building from Source
The latest sources of Visual D are available from the github repository at https://github.com/dlang/visuald.
Visual D consists of a number of components that need to be built separately:
- visuald: the core package loaded as a language service by Visual Studio: visuald_vs10.sln
- dparser: the semantic engine integrated as a sub module: vdc/abothe/VDServer.sln. Needs VS 2017 or later
- vdextensions: some extensions to visuald only accessible via C#: vdextensions/vdextensions.csproj
- dbuild: MSBuild integration: msbuild/dbuild/dbuild.csproj
- mago: the debug engine: ../../mago/MagoDbg_2010.sln
- cv2pdb: conversion of CodeView 4 debug information into PDB file: ../../trunk/cv2pdb/src/cv2pdb_vs12.sln
- pipedmd, dcxxfilt: additional command line tools in the "tools" folder
Building the Visual Studio extension package
Prerequisites
You need the following tools to build main package of Visual D:
- Visual Studio 2013/2015/2017/2019
- a recent version of Visual D
- Visual Studio Integration SDK for VS2013 or later (enable it during VS installation.)
- Windows SDK 6.0A or later (tested with most versions up to 10.0.17763.0)
- DMD 2.084 or newer
Short build instructions:
- Load visuald_vs10.sln into Visual Studio 2013+.
- Select configuration "Debug COFF32|Win32"
- Build project "build". You might get prompted to reload the solution.
- Build project "VisualD".
Longer build instructions:
There is an AppVeyor project that verifies recent changes to the development branch of Visual D. This can also be used as a reference for the build process.
The Visual D source code is usually updated to work with the latest release version of DMD (2.086.0 as of now), so you should use this release of the compiler when using the latest git checkout.
To start developing or debugging, you should load visuald_vs10.sln in Visual Studio with Visual D installed. The preferred configuration to use is "Debug COFF32|Win32". This chooses building with the Microsoft runtime libraries. As Visual Studio is a 32-bit process, an extension has to be built for that platform, too. Build the "build" project at least once to build the necessary prerequisites and tools, e.g. D translations from the Windows and Visual Studio SDK.
If you want to build against the Digital Mars toolchain using OMF object files, you'll need coffimplib from (http://ftp.digitalmars.com/coffimplib.zip) installed somewhere in your PATH. Use Configuration "Debug OMF|Win32" in that case.
Deployment
You should debug Visual D within Visual Studio using a different branch in the registry, so it does not interfere with your working environment.
$(UL- in the following items, VS 2015 is similar to VS 2013 (replace version 12.0 with 14.0), and CS 2019 is similar to VS 2017 (replace version 15.0 with 16.0).
- Start the IDE with the new settings branch via
devenv /RootSuffix D
This will create a new set of settings to be used for debugging. - Copy the files from $(VSINSTALLDIR)\Common7\IDE\Extensions\Rainer Schuetze\VisualD into the folder $(APPDATA)\Local\Microsoft\VisualStudio\12.0\Extensions\VisualD (replace 12.0 with 15.0_<id> for VS2017 with <id> some identifier generated during VS installation)
- Move the files from $(VSINSTALLDIR)\Common7\IDE\Extensions\Rainer Schuetze\VisualD into the folder $(APPDATA)\Local\Microsoft\VisualStudio\12.0D\Extensions\VisualD (replace 12.0D with 15.0_<id>D for VS2017 with <id> some identifier generated during VS installation)
- in $(APPDATA)\Local\Microsoft\VisualStudio\12.0D\Extensions\VisualD\visuald.pkgdef, replace the path "C:\Program Files (x86)\Visual D\visuald.dll" with your debug build output path.
- Modify a line in `$(VSINSTALLDIR)\Common7\IDE\devenv.pkgdef:
-"PkgDefSearchPath" = "$ApplicationExtensionsFolder$;$RootFolder$\Common7\IDE\CommonExtensions;$RootFolder$\Common7\IDE\devenv.admin.pkgdef;"
+"PkgDefSearchPath" = "$ApplicationExtensionsFolder$;$RootFolder$\Common7\IDE\CommonExtensions;$AppDataLocalFolder$\Extensions;$RootFolder$\Common7\IDE\devenv.admin.pkgdef;"
- for VS2015 or earlier delete these hives in the registry:
- HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0D
- HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0D_Config
- Start the IDE with the new settings branch via
devenv /RootSuffix D
- As administrator, execute from the command line:
<path-to-visual-studio-sdk>\VisualStudioIntegration\Tools\Bin\VSRegEx.exe getorig 9.0 D
- and register the compiled debug plugin with
trunk\nsis\register.bat
- The IDE can then be started with the new settings branch via
devenv /RootSuffix D
Building the installer
The standard build procedure for the release version is to execute "nmake install_vs" in the trunk directory. Please check the variable settings at the top of the Makefile and adjust them to the installation directories on your system.
- cv2pdb checked out to ../../cv2pdb/trunk for historic reasons
- mago checked out to ../../mago
- binutils 2.25 extracted to ../../binutils-2.25
Good luck!