You can write such a tool yourself in C #, for example, look at the classes in the Microsoft.Build.Construction namespace, they are designed to create projects programmatically.
However, a simpler but more universal option uses the same property sheet in all your projects and sets all the directory paths you need. It also has a huge advantage in that it is reusable, so if you ever decide to change your output directories, all projects that link to your property sheet will be automatically affected. For instance:
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <MyMainDir>$(ProjectPath)\..\</MyMainDir> <OutDir>$(MyMainDir)\bin\$(ConfigurationName)</OutDir> <IntDir>$(MyMainDir)\tmp\$(ConfigurationName)</IntDir> </PropertyGroup> </Project>
First you recognize your “main directory”, that is, the one called “project” in your question, and then set the output and intermediate directories on it and the name of the current ConfigurationName , which by default is Debug or Release .
Now it's just a matter of importing this property page into your project: go to View->Other Windows->Property Manager , right-click the project (s), select Add Existing property Sheet . Or you can manually add <Import Project=....> to the project file.
While you are on it, you can also add compiler / linker parameters to the property sheet so that all your projects use the same parameters. This will take some time, but will save you a lot of time in the future, since you do not have to change the same parameters in the project settings again and again.
source share