Changing the default executable path for Visual Studio 2017 and above.

Last edited on

Introduction

This article explains how to set the default executable path for every new Visual Studio project. This can be useful for binding new custom executables located in a custom directory. This article explains also how to revert to the default settings in the case of a broken path.

Modifying the executable path in Visual Studio

To modify the executable path of a Visual Studio project, it is first necessary to load a C++ project. Then use the context menu to view the properties of it and select the item “VC++ Directories”.

An item called “Executable Directories” is then visible as in the following screenshot.

'VC++ Directories' of a Visual Studio project

It is then possible to edit it with the following dialog:

Editing the executable directories

This page permits to select between inherited settings or custom settings. We will show how to modify the inherited settings.

Setting the default inherited settings in Visual Studio

Visual Studio use two different settings files for 32 bits and 64 bits applications.

ArchitectureLocation
32 bits%HOMEPATH%\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props
64 bits%HOMEPATH%\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.x64.user.props

Removing it permits to revert to the original settings from Visual Studio. To set a custom value create an XML file with the following template and edit the ExecutablePath value:

<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ExecutablePath>c:\Something</ExecutablePath>
  </PropertyGroup>
</Project>
Custom Exetable Directories set to c:\something