Solution References, Dependency Inversion and Controlling Builds

Here’s a trick for your medium to large Visual Studio projects. In Tools/Options/Projects, Solutions/Build, Run there’s an option “Only build startup projects and dependencies on Run.” If you check this, it will do what you expect when you hit F5 – Visual Studio will only build the startup project and any direct dependencies. This is an individual machine setting, not a project setting.

But what if you are using dependency injection though MEF or an Inversion of Control container? In these scenarios, the main application probably references only a common assembly(ies) that have interface declarations. Implementations are in other assemblies that are not directly referenced. So, does that mean that if you use dependency injection on any project you can’t use the build limitation on any other solution?

Enter Solution/Project Dependencies! You might not have heard of this feature because it’s very well hidden in Visual Studio. I have heard these referred to as Solution References because the option appears on the Solution right click. “Project Dependencies…” have nothing to do with usual project references. This is a new kind of dependency indicator which is used for the minimal build. Creating this dependency does not create a project reference.

In case the Solution References dialog doesn’t seem intuitive, you select the project you want to work with in the combo box (A). This displays a series of check boxes for other projects in the solution (B).

clip_image001

A normal project entry is:

Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Earth", "Earth\Earth.vbproj", "{8BFC7D54-B621-4E23-9CA9-101DDF9DFC79}"

EndProject

If you have a dependency, this entry looks something like:

Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "HelloPlanet", "HelloPlanet\HelloPlanet.vbproj", "{D2CF0625-0549-49B4-99D5-C4CCC6068814}"

ProjectSection(ProjectDependencies) = postProject

{8BFC7D54-B621-4E23-9CA9-101DDF9DFC79} = {8BFC7D54-B621-4E23-9CA9-101DDF9DFC79}

EndProjectSection

EndProject

Now, your dependency will be built along with any referenced projects!

Nothing good to say since July, Kathleen? Really?

Nothing good to say since July, Kathleen? Really?”


That’s part of a comment Jerry Nixon left on my blog. I need to get off my butt and give some explanation for my silence.


Life got in the way, then a break to figure out what I’m doing next.


Last July I took a job at Digital Folio. Startups are dynamic environments and this time the wind shifted such that my responsibilities were much different than I expected. This was not altogether bad. I really enjoyed leading a group and I was working with amazing folks. But it wasn’t what I wanted to do so I left just before the first of the year. Since I was also supporting a long term client, I was working two jobs, maintaining a speaking schedule, and committed to working out and taking better care of myself. I often felt I didn’t have time to breath.


But that changed in late December. It’s nearly March. Where did those two months go?


I’ve made a significant lifestyle change. I’ve given up having a home. Home-free is probably a better phrase than homeless, because I am embracing this by choice and it’s the culmination of a process that started two years ago. I sorted everything I owned to store, donate or keep with me. And then I went through the “keep with” stuff twice more the same way. Everything I now own is either in storage or fits in my car. And no, it’s not a van but my lovely 37 mpg Hyundai Veloster.


I suppose there is a blog post inside me somewhere on what I’ve learned about stuff, but I don’t think that processing is done.


I’ve always wanted to drive US 64 from end to end. I used to drive bits and pieces of it and thought they were the most beautiful pieces of highway. I wanted to keep going, so I did – well, at least half of it. The other half is scheduled for late June if all goes well. We’ve lost so much of the gracious old highways. It was nice to travel what is left of this one before the 4 lane expressways and semi-expressways eat all of it. My mother thinks I am silly and nostalgic (her home state Tennessee had done the most damage to US 64) because she says everyone other than me just wants to get where they are going. US 64 is probably a blog post too.


And where does a home-free person stay? Friends, family, house-sitting, hotels, monthly rentals, camping – although I’m waiting for summer for the camping part. At least that’s what I think will happen. I’ve only been at this for a little while and I may quickly grow weary of it. My theory is that there are things I can bring that are different for everyone that will have people look forward to me coming back. I hope so.


It does mean I’m available for on-site coaching and possibly other work. That’s a different blog post, but I want mid-term part time engagements where I can watch a team grow and help them meet technical, team and personal goals without disrupting ongoing projects or becoming dependent on my presence.


My tentative plans for the mid-term are to be in Colorado most of March, on the East Coast and traveling from there to Seattle in April, in Seattle during May, and spending June back in Colorado to see family, kayak and backpack. Next events are Wintergrass (Bellevue), the MVP Summit and DevConnections March 26-30. I’m speaking at the Northern Colorado .NET User Group March 12, Vermont .NET in Burlington April 9th, Great Lakes .NET User Group in Southfield, Michigan April 18th. I’m also trying to get in touch with the user group in Fargo, ND or in Illinois to see if I can set up a talk when I drive through April 23-26.


In addition to mentoring, I have an exciting project that I hope to be able to talk about next week and a boatload of blog posts in process on work my son and I have been doing looking for common themes between the many, many flavors of composition.