Gil
Gil

Reputation: 11

Visual Studio: Custom Build Rules - per solution?

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.

Upvotes: 1

Views: 1505

Answers (1)

Alex Cohn
Alex Cohn

Reputation: 57173

.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>

Upvotes: 1

Related Questions