Set the Platform Toolset property to your preferred Windows XP toolset. Select the Configuration Properties > General property page. In the Property Pages dialog box for the project, set the Configuration dropdown to All configurations. In Solution Explorer, open the shortcut menu for your project, and then choose Properties. Those apps can also run on more recent Windows operating systems. Only Windows desktop apps created by using a Windows XP platform toolset can run on Windows XP and Windows Server 2003. It also configures project properties to appropriate default values, for example, the specification of a compatible linker for down-level targeting. The Windows XP platform toolset that's included in Visual Studio is a version of the Windows 7 SDK, but it uses the Visual Studio 2017 C++ compiler. In the Individual components tab, under Compilers, build tools, and runtimes, choose C++ Windows XP Support for VS 2017 (v141) tools, and then choose Install or Modify.
When you initially install Visual Studio, or when you modify an existing installation, make sure the Desktop development with C++ workload is selected. To get the v141_xp platform toolset and components to target Windows XP and Windows Server 2003, run the Visual Studio Installer.