Welcome to MSDN Blogs Sign in | Join | Help

Incorporate Layer Validation in your Builds

As I promised in my last post, I want to show you how you can make Layer Validation part of your build process. I'm going to assume you've followed along from last post to make things easy. Again, this is all possible in the VSTS 2010 CTP.

  1. Unload the "Client" project ( Right click on the "Client" project and select "Unload Project" )
  2. Once unloaded, right click on the unloaded "Client" project and select "Edit Client.csproj":

    image
  3. Find this line:
     
    <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

    And add this line right after it:

    <Import Project=" $(ProgramFiles)\Microsoft Visual Studio 10.0\Team Tools\Architecture Tools\Microsoft.VisualStudio.TeamArchitect.Validate.Targets"/>

    This is a temporary step to make this work in the CTP. At RTM ( and even for Beta ), the new targets file will be part of the core MSBuild targets file.
  4. Save the project, then reload.
  5. You'll be presented with this dialog:

    image 
  6. Click on the "Load project normally" and click OK.
  7. Now drag the "FirstLayerDiagram.layer" file from the "Diagrams" solution folder into the "Client" project.
  8. Delete the "FirstLayerDiagram.layer" file from the solution folder.
  9. Select the "FirstLayerdiagram.layer" file that is now in the "Client" project, and set its "Build" action to "Validate":

     image
    Now if you did want to leave the "FirstLayerDiagram.layer" file in the "Diagrams" solution folder, you would have to manually edit the "Client.csproj" file, changing this line:

    <Validate Include="FirstLayerDiagram.layer" />

    to this:

    <Validate Include="..\FirstLayerDiagram.layer" />

    You're project would look something like this ( notice the little arrow overlay, indicating that this is a reference to a file elsewhere ):

    image

  10. Now at this point you could drop to the command line, assuming the Client.csproj file is in "c:\temp\Layer Validation\Client", and type "msbuild /t:ValidateArchitecture".

 

Ideally, it would be great to incorporate this step into the build process whenever you build the solution or Client project. You would do something like add a DependsOn="ValidateArchitecture" attribute to the "AfterBuild" target in the project file. Unfortunately, the same bug that requires you to refresh the Architectural Explorer after each build of the project will prevent this from working as it should. Clearly, this will be corrected by RTM.

Hope that helps!

Cameron

Published Thursday, December 11, 2008 5:20 AM by camerons

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Layer Validation with the VSTS 2010 CTP

Layer Validation with the VSTS 2010 CTP

Thursday, December 11, 2008 9:56 AM by Geek Noise

# re: Incorporate Layer Validation in your Builds

It's nice to see how a professional explains things :)..I mean I regularly read all of your VSTS 2010 posts and try out everything you do in your posts..for me that is the easiest way to learn new things..and I gotta say I'm a fan...

Erik Cox

http://www.notionsolutions.com

Sunday, December 21, 2008 5:27 AM by Erik Cox

# Visual Studio Team System 2008 Architecture Edition with MSDN Premium Subscription

[Nacsa Sándor, 2009. január 19-31.] Ez a Team System változat a szolgáltatás-orientált (SOA) elosztott

Sunday, February 01, 2009 4:41 PM by Termékinformációk fejlesztőknek

# How to make Layer Validation Diagrams work in the build

In Visual studio 2010 Team Architect edition, you have a new type of diagram available, called the layer

Tuesday, June 09, 2009 5:12 PM by Marcel de Vries, MVP Team System

# VSTS Rangers Projects – Using VSTS 2010 BETA-1 as part of the TFS Migration tools initiative

As mentioned in previous posts a huge effort of the TFS Migration tools initiative was to reverse engineer

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker