How to include different source files for different configurations of a single .VcxProj

msr 21 Reputation points
2022-06-07T21:13:19.253+00:00

Hi

I have a .SLN with 2 .Vcxproj (LIB and a driver). My .VcxProjs has 2 configurations.
For one of the configuraion I need the sources files from dir1 to be used. For other configuration I need the source files from dir2 to be used.
Both the dirs have same file names. I can't combine above 2 dirs or have single dir with those files.

Anyway to have a configuration of an .vcxproj to selectively pickup the src files to compile given above preconditions and dir-structure?
Also I would like the files from both dirs to be listed in teh solution explorer.

Thanks

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
2,452 questions
No comments
{count} votes

Accepted answer
  1. RLWA32 28,676 Reputation points
    2022-06-08T00:14:16.087+00:00

    I put together a sample solution containing one C++ project (.vcxproj). The project include two folders (Dir1 & Dir2) that each contain two source code files. The project contains configurations that will build a console application from the source files in either Dir1 or Dir2 for Debug/Release and x86/x64. The console application prints the platform, configuration and source files that were used to build it to the console. You can get it from OneDrive at https://1drv.ms/u/s!AmnqrCFBv4nDgji0Z8lEhRX0RBtq?e=RUcaGf

    No comments

0 additional answers

Sort by: Most helpful