22 February 2011

Dependency Management

In the world of programming, nothing guarantees an instant ulcer more than change. Object-oriented programming (OOP) is particularly susceptible to problems stemming from changes made to objects upon which the code is dependent. However, when dependencies are well managed, adverse affects from change can be kept at bay.

Fix TFS "Cloaked Path" Problem

Here's the situation you're likely facing: you've been tasked to add a Visual Studio (VS) solution to an Team Foundation Server (TFS) as a Team Project (TP). You launched Visual Studio or the TFS Web interface, and then navigated to the TP in the Source Control Explorer. You dragged the solution folder from Windows Explorer into Source Control Explorer. The Add to Source Control dialog appeared, but you notice the following:
  • The Items to add tab says "(0)", indicating no items will be added
  • All files are listed in the Exlcuded items tab
  • The status message below the item tabs reads, "This item cannot be added because its destination path is cloaked"
  • You are asking yourself, "What the heck is a cloaked path?"
You probably tried simply clicking the Finish button instead of the Next > button, but receive a message stating, "No eligible items were found for addition."

Well, there is an easy solution for that!

15 February 2011

The Virtual PC Login Blockade

"Virtual PC Won't Let Me Log In!"

I've heard that one before.  So, you're using Microsoft Virtual PC for quality assurance (QA) testing, or for other use. Things are going fine, until after a reboot of the virtual machine (VM). When it boots, the VM operating system (OS) prompts you to log in. (See image.) No matter what you enter, the machine just won't log in! Even the local administrator credentials won't work.

29 December 2010

Advanced C# Windows Service Installation

Click this link, to download source code.
Today, I'm going to show you how to efficiently create Windows Services and deployment projects, using C# in Visual Studio 2010.  These techniques illustrate methods of centralizing key information about the services included in the project, to prevent typos and other mistakes attributed to setting similar properties in decentralized locations.

This example is especially useful for projects that contain several services that use common code bases.  For example, I have a service suite that monitors several FTP drop directories on a server.  Each watcher performs different, custom actions; but, 90-95% of the code is common to all services.  For this and other reasons not discussed here, it makes sense to simply package all services in one project.  The more popular alternative is to create a common library, install to GAC, and create individual service solutions.

The bottom line is that I wanted to simplify management and deployment.  To simplify service registration, I created a "ServiceInfo" class attribute into which all service information is entered, instead of mucking about in several ProjectInstaller files.  View the full article, to get source code and a complete walk-through.

UPDATE 13 MAR 2012: I updated the code sections, to use formatted HTML, instead of using JavaScript code coloring.  The code was formatted a bit, for fit, and to make the LINQ more efficient.  Therefore, the code in the download won't be exactly the same, but it works.