Team Build and Layer Validation

[NOTE: This post is part of a blog series, the start of which is here.]

I’ve had a couple of posts to date about how to use the new Layer Diagram, such as this one, and provided a quick video showing the basic usage of the diagram. What I’d like to discuss in this post is how to incorporate Architecture Validation into your Team Builds so that the analysis that can be run in the IDE becomes part of you nightly or Continuous Integration builds.

Towards the end of this quick video ( ~5 minute mark ), I mention a couple ways you can enable layer validation to occur whenever you build your solution inside VS. It’s as simple as enabling the “Validate Architecture” property on the Modeling Project that contains the layer diagram you want to validate your code against.


Now keep in mind that you can have many layer diagrams in a single Modeling project, so turning on that flag will run validation against all of the layer diagrams in that project.

Another way of kicking off the validation is via the command line. If you run “msbuild /p:ValidateArchitecture=true <solution name>”, that will also kick off validation against any modeling project in that solution, regardless of the “Validation Architecture” property on those projects.

Since validation is completely enabled via msbuild custom tasks, incorporating that validation into your TeamBuild build definitions is very simple ( though not very discoverable ).

Here is a shot of a a build definition showing the addition of the msbuild property being passed via the “MSBuild Arguments” property:


That’s it! With your build definition modified as above, architectural validation can now be made a part of your overall build workflow.