Blogging again????#

You know sometimes it’s just sad how fast time can go by.  Looking back it’s been well over a year maybe two since I last blogged.  WOW, that’s not cool.  So what the hell happened, well LIFE I guess.  Let’s see:

question-mark1a.jpg

  • I had my second child ( girl, Addison ).  We are blessed to have one of each and both healthy. 
  • I got to meet Bill Gates, Steve Ballmer and all of the rest of the Microsoft executives
  • Bought a Honda ( needed a 4 door with 2 kids )
  • This fiscal year I will have billed over 2300 hours which doesn’t account for my other job.  Can you say Year of the Death March!!!
  • Ran into Sieg from the Deadliest Catch at SeaTac
  • Learned how to make the perfect Margarita!

Regardless a lot has happened and it’s time to talk technology again.  I love it and really miss doing it. With all of the great stuff here upon us now, it’s time to start sharing. I was reading MSDN Magazine the other day when I ran across an article about MSBuild and best practices which really got me thinking.  There were two items that really stuck out for me:

  1. Compilation of large source trees.  I think it’s a must read but caution readers that “large” can mean many different things. 
  2. Reference Management

While both were explained pretty well, lets put #2 into practice.  *I’M LAZY* ( in a good way of course ). I would much rather write something once rather than screw with it time and time again, especially the stuff you have to do like build work. 

So lets talk assembly references….

Assembly references can be easy as you want it to be but sometimes a little prep work will go a long way. The .NET compilers and runtime both have a specific order in which they look for references.  If you look in your framework folder for Microsoft.Common.Targets you will find the following:

The SearchPaths property is set to find assemblies in the following order:  legos

  1. Files from current project - indicated by {CandidateAssemblyFiles}
  2. $(ReferencePath) - the reference path property, which comes from the .USER file.
  3. The hintpath from the referenced item itself, indicated by {HintPathFromItem}. 
  4. The directory of MSBuild's "target" runtime from GetFrameworkPath.  The "target" runtime folder is the folder of the runtime that MSBuild is a part of.
  5. Registered assembly folders, indicated by {Registry:*,*,*}
  6. Legacy registered assembly folders, indicated by {AssemblyFolders}
  7. Look in the application's output folder (like bin\debug)
  8. Resolve to the GAC.
  9. Treat the reference's Include as if it were a real file name.

So what if your not one of those nine?!?!?

Since it’s all just angle brackets we can extend the “out of the box” search paths.  As it was explained in the article you can override the property AssemblySearchPaths.  Aaron had a great post on MSBuild Property Evaluation, it’s something you should read.  Overriding a property is as simple as importing your own target file into the stack and then resetting the property ( for most cases ).  You could also just add a the same property further down the stack in the same file.  Both are essentially the same. With MSBuild the *stack is always important*.  If you were to import your target file or override a property to early you might change the way the entire build system works.  There are a number of properties that work like:

This is a very common practice throughout MSBuild implementations.  As you can tell it’s just a way or protecting yourself from a change in behavior upstream. Remember MSBuild parses top down to you have no influence what might be done afterwards.  In our case what we want to do is import our targets file after the Microsoft.Common.Targets file in the csproj or vbproj file(s).

*NEW*

By doing so AssemblySearchPaths will be “” and initialize itself as expected.  So if we want to add to it it’s as simple as ( snip from MyTargets.Targets ):

....
   

     
          $(AssemblySearchPaths);
          C:\binaries\;
     

   
....

  1. Define a Property Group
  2. Define the Property ( AssemblySearchPaths )
  3. Set it to itself and add to itself

Important point, Reference Paths are folders not files.  So now if you compile from the cmd line or from VS you will have your paths in the stack. The easiest way to see what is going in is to simply run msbuild.exe /t:rebuild /v:diag on your sln file.  That will dump everything that took place during the execution from MSBuild. Even the order of folders it searched for.  You will actually be able to see the reference pats listed that it couldn't find.

But we are not done yet.  We have a hardcoded path and remember, I’m lazy. How about we bootstrap ourselves into the build process and read the file system building the search paths based on a “root” folder you specify?  Then any machine should work without any change.



    
        $(SolutionDir)..\MyBinaries\**\*.*
    

    
   
    
      
    
    
    

  
      
        $(AssemblySearchPaths);
        @(binariesFound->'%(RootDir)%(Directory)');        
      
    
  

Important points:

  1. InitialTargets was set. This gives us the ability to run *first*.  Why? Well we want to read the file system and build the list of folders.
  2. We create an item during the execution of the target rather than statically.
  3. We later transform that target just adding the folder rather than the whole file path.

Team Build has a similar concept but much easier.  At the bottom of any tfsbuild.proj fiile there is a commented collection called AdditionalReferencePath. It works the same it’s just that the Team Build process does it all for you already.

Friday, May 22, 2009 8:56:03 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Microsoft.SDC.Tasks, New Version Released#

If you are doing anything with .Net 2.0 chances are you have a set of MSBuild files supporting your application.  That means you already know MSBuild just rocks.  What better than MSBuild? MSBuild with a sweet task library to support it of course!  That task library would be the Enterprise Solutions Build Framework or Microsoft.SDC.Tasks as I like to call it.

Well they just released a new version!  The biggest change was the introduction of BizTalk 2006 tasks.  If BizTalk isn't your fancy then you will be pleased to also know there are some new TFS tasks also.

To find out more information visit http://www.gotdotnet.com/codegallery/codegallery.aspx?id=b4d6499f-0020-4771-a305-c156498db75e

These guys do a stellar job!  I have been using this library for about a year now and it goes everywhere I go.

Wednesday, July 12, 2006 8:32:38 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Microsoft Build Sidekick#

I have decided there are not enough people blogging about MSBuild, so here is the first post of many more to come. 

I ran across a free MSBuild editor the other day made by Attrice called Microsoft Build Sidekick.  I've loaded it up and I am impressed.  I especially love the feature where you can look at all of the items your build file imported. 

Add it to your toolbox @ http://attrice.info/msbuild/

Monday, June 19, 2006 3:20:11 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

The Build Master#

I don't think anyone will argue but the majority of technical books are used for reference.  OK so every so often a new book comes out and you read it cover to cover.  Well that time has come. 

Vincent Maraia has just authored a book called The Build Master.  If you have anything to do with software development then you MUST read this book.  I don't care how good you are, how many products you shipped or if you are already a build master, you MUST read this book.

Every development shop must address most if not all of the topics found in this book.  If you're not, then you really need to invest some time and money in yourself and clean shop.  I guarantee things could be better.  Just ask yourself a few questions:

  • Do you have a good concurrent development mailline strategy? Do you know what one is?
  • Do you know how to branch and merge?
  • Do you version?
  • Do you have any automation?
  • Do you have a build process?
  • Do you have a build team?

If you have answered No to any of these questions then just go buy it now and start reading.  Again regardless no matter who you are, you still need to read this book.

Vincent Maraia, Great Read and Great Job!!! I can't wait for the next one.


Table of Contents

  1. Defining a Build
  2. Source Tree Configuration
  3. Daily Not Nightly Builds
  4. The Build Lab
  5. Build Tools
  6. SNAP Builds
  7. The Build Environment
  8. Visioning
  9. Build Security
  10. Managed Code Versus Unmanaged Code Builds
  11. Building for International
  12. Build Verification Tests
  13. Building Setup and Deploying Every Day
  14. Ship It
  15. Product Support Services
  16. Hotfixes or Patch Management
  17. Suggested Steps to Change Your Religion or Philosophy (Corporate Culture)
  18. Future Build Tools from Microsoft
Thursday, June 08, 2006 9:07:02 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

MSBuild, Where does one get started#

Long and short, if you don't know anything about MSBuild, it's time to hit the links below.  Honestly it will do nothing but save you time and automate those dreaded processes.  The links below will get you pointed in the right direction.

General Links

Blogs

Packages

Team Build

Wednesday, May 31, 2006 9:22:43 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

VSTS Jumpstart, things you will end up asking for#
Internet Links
Visual Studio Team System Home
Getting Started with Team Foundation
MSDN Technical Forums
VSTS Downloads
Team System Rocks
How To Links
Visual Studio Team System Install Guide
TFS Warehouse Troubleshooting
Step-By-Step Guide to Converting Web Projects from Visual Studio .NET 2002/2003 to Visual Studio 2005
VSTS Backup and Restore Procedures
Team Foundation Server Permissions
Team Foundation Server Default Groups, Permissions, and Roles
TF.exe Command Line Reference
Books
Working with Microsoft Visual Studio 2005 Team System
Test-Driven Development in Microsoft .NET
Test Driven Development: By Example
Refactoring: Improving the Design of Existing Code
Refactoring to Patterns
Bloggers
Rob Caron
Rick LaPlante
Eric Jarvi
Buck Hodges
Jeff Beehler
Eric Lee
Nagaraju Palla
Khushboo
Gautam
Visual Studio Team System User Education
WebCasts
Introduction to Visual Studio Team System
How and Why Process Guidance Matters in Visual Studio 2005 Team System
Visual Studio 2005 Team System: Enterprise-Class Version Control
Managing Work with Visual Studio 2005 Team System
Test-Driven Development Using Visual Studio Team System
Accessing Visual Studio 2005 Team System Using the Teamprise Plug-In for Eclipse (Level 200)
Best of Launch: Visual Studio 2005 Team System (Level 200)
Load and Web Testing with Microsoft Visual Studio 2005 Team System (Level 200)
Migrating to Microsoft Visual Studio 2005 Team System (Level 200)
Shipping on Time and Under Budget with Visual Studio Team System (Level 200)
3rd Party Products
Teamprise
TeamLook
TeamPlain
VSTSEclipse 
VSTSPlugins
Tips and Tricks
  • When checking an item into source control you have the ability to associate a WI with that change set.  If you choose to do so there are two options, Resolve and Associate.  If you select Resolved the WI state will advance to the next state.
  • Fully process the TFS warehouse
  • Team Explorer blank ( missing server or lost network connection )
    • Delete the cache folder @
      • C:\Documents and Settings\<user>\Application Data\Microsoft\VisualStudio\8.0\Portfolio Explorer
      • C:\Documents and Settings\<user>\Local Settings\Application Data\Microsoft\Team Foundation\1.0
  • Tools to modify WIT
    • WitExport.exe, WitImport.exe, WitFields.exe
    • These are found @ c:\ProgramFiles\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\
  • Change the TFS warehouse run interval
  • Secure a WIT transistion
    • <TRANSITION from="State 1" to="State 2"
         for="[global]\StateChangers"
         not="[global]\GroupThatsRestrictedStateChanges" >

  • Drivers required to create adhoc Excel reports against the TFS Analysis Services.  Install Microsoft Core XML Services (MSXML) 6.0 and Microsoft SQL Server 2005 Analysis Services 9.0 OLE DB Provider from the SQL Server 2005 Feature Pack

MSBuild & Team Build

Jomo Fisher on MSBuild

Robert McLaws MSBuild Compatibility Toolkit 1.0

Nagaraju Palla's Building binaries targeting .NET 1.1 and .NET 1.0 in TeamBuild

Khushboo's CI using Team Foundation Build 

 
.NET SDC Solution Build & Deployment Process & Tools
Downloads
Visual Studio 2005 Web Application Projects, ScottGu On Web Application Projects
Visual Studio 2005 Web Deployment Projects
SQL Server 2005 Feature Pack
Tools

FiddlerPopUp Forum Post

Test Driven .Net

BizUnit

.Net | MSBuild | TeamBuild | VSTS
Wednesday, February 08, 2006 11:32:17 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Converting a csproj into a test csproj#

Short answer.

It's as simple as adding one line to your csproj which in turn tells the IDE to treat that project like a test project.  Add the following line to your main PropertyGroup:

<ProjectGuid>{04082EBA-C85C-4336-B3FD-9891096BAA0F}</ProjectGuid>

Then just reference Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll and you are on your way.  Be sure to verify that Guid between releases. 

Long Answer.

When I start a project I create the base set of known assemblies that project will need.  I also add an additional test project which will contain any Scenario, Load and Stored Procedure tests.  Then I convert all assemblies to test projects.  I am a firm believer in Test Driven Development.  IMHO it is the only way to properly write code.  Having said that over the years I have developed my own set of TDD practices; one of which is the physical placement of your unit test classes in the assembly their testing.  Why? Well I will explain that in a future post call Unit Testing with Partial Classes.

With any decision there are of course trade-offs. In this case the trade-off is around the IDE interaction with hosting type projects, ie exe or web.  After you convert an exe to a test project, when you decide to run ( F5 ) it will actually fire off Test Manager rather than the launch app.  If you are a TDD bigot like me this is actually the correct action; if your not, I know your already complaining.  BUT all is not lost!  There is a little tool us TDD bigots keep in our back pocket at all times, TestDriven.Net.  This is an Visual Studio add-in and it allows you to execute your unit tests with just a right click.  If you choose to use this tool it isn't necessary to convert your project to a test project but rather just reference the Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll.  This will allow you to fire your app as intended and run your tests with the same project configuration.

Disclaimer: this is not a Microsoft recommend practice.  You can find more information about the Visual Studio Team System Testing Framework here.

Saturday, January 21, 2006 8:36:27 AM (Central Standard Time, UTC-06:00) #    Comments [2]  | 

 

VS 2002 / 2003 / 2005 Conversions and Building#
Friday, January 20, 2006 6:37:36 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Multiple Test Runs in one BuildType#

If you are using TeamBuild then this post is for you. 

In TeamExplorer when you create a new build type it will create a *.proj file.  During the creation of this build type, you will be asked which TestLists you would like executed in that build type.  Once completed if you open that proj file, you will see an item group that looks something like the following:

<ItemGroup>
  <MetaDataFile Include="$(SolutionRoot)\TestProject1\TestProject1.vsmdi">
    <TestList>TestList1;TestList2</TestList>
  </MetaDataFile>
</ItemGroup>

For this build type there are actually 2 different TestLists, TestList1 and TestList2.  These TestLists will get executed and reported on in the build.  With the out of box ItemGroup configuration both lists will actually roll up into one set of test results; but what if you wanted to to actually have multiple test runs for a given build. 

We can make a very slight modification to that generated code block and actually get a separate test run per test list.

<PropertyGroup>
  <VsmdiPath>$(SolutionRoot)\TestProject1\TestProject1.vsmdi</VsmdiPath>
</PropertyGroup>

<ItemGroup>
  <MetaDataFile Include="$(VsmdiPath)">
    <TestList>TestList1</TestList>
  </MetaDataFile>

  <MetaDataFile Include="$(VsmdiPath)">
    <TestList>TestList2</TestList>
  </MetaDataFile>
</ItemGroup>

More to come....

Tuesday, January 17, 2006 11:50:43 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

All content © 2010, Clark Sell
On this page
This site
Calendar
<September 2010>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789
Archives
Sitemap
Blogroll OPML
Disclaimer

Powered by: newtelligence dasBlog 2.3.9074.18820

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts


Pick a theme: