I just finished setting up an out-of-place build system for our existing C++ code using inherited property sheets, a feature that seems to be specific to the Visual C++ product. Building out-of-place requires that many of the project settings be changed, and the inherited property sheets allowed me to change all the necessary settings just by attaching a property sheet to the project. I am migrating our team from C++/MFC for UI to C# and WPF, but I need to provide the same out-of-place build functionality, hopefully with the same convenience. I cannot seem to find a way to do this with C# projects – I first looked to see if I could reference an MsBuild targets file, but could not find a way to do this. I know I could just use MsBuild for the whole thing, but that seems more complicated than necessary. Is there a way I can define a macro for a directory and use it in the output path, for example?
I just finished setting up an out-of-place build system for our existing C++ code
Share
I’m not quite sure what an ‘out-of-place’ build system is, but if you just need the ability to copy the compiled files (or other resources) to other directories you can do so by tying into the MSBuild build targets.
In our projects we move the compiled dlls into lib folders and put the files into the proper locations after a build is complete. To do this we’ve created a custom build .target file that creates the
Target‘s,Property‘s, andItemGroup‘s that we then use to populate our external output folder.Our custom targets file looks a bit like this:
The .csproj file in Visual Studio then integrates with this custom target file:
In a nutshell, this build script first tells MSBuild to load our custom build script, then adds the compiled file to the
LibFilesItemGroup, and lastly ties our custom build targets,DeleteLibFilesandCopyLibFiles, into the build process. We set this up for each project in our solution so only the files that are updated get deleted/copied and each project is responsible for it’s own files (dlls, images, etc).I hope this helps. I apologize if I misunderstood what you mean by out-of-place build system and this is completely useless to you!