Visual Studio: Custom Build Rules - per solution?

1.4k Views Asked by At

I need to define a custom build rule for files in my projects. However the rule may be different for different solutions (more percisely, for the same solution in a parallel dev branch).

I have two questions:

  1. Can a .rules file be specified in a location relative to the solution? That way I'd be able to create rules per development branch.

  2. MSDN says that the custom rule is inheritable similarly to the properties (vsprops). How can that be achieved? Where do I specify the inheritance?

Thanks,

Gil Moses.

1

There are 1 best solutions below

4
On

.vcproj file will contain the following clause:

 <ToolFiles>
    <ToolFile
      RelativePath="..\my.rules"
    />
 </ToolFiles>

You can use $(SolutionDir) to customize placement of the .rules file, like this:

 <ToolFiles>
    <ToolFile
      RelativePath="$(SolutionDir)..\..\..\my.rules"
    />
 </ToolFiles>