|
 Tuesday, January 08, 2008

TFS - ItemExistsException Fix

Oh what a P.I.T.A. this error has been. I received this error today...

Microsoft.TeamFoundation.VersionControl.Client.ItemExistsException: The item $/path/to/myFile.cs already exists. ---> System.Web.Services.Protocols.SoapException: The item $/path/to/myFile.cs already exists. --- End of inner exception stack trace --- at Microsoft.TeamFoundation.VersionControl.Client.Repository.ProcessHttpResponse(HttpWebResponse response, Stream responseStream, WebException webException, XmlReader& xmlResponseReader) at (...)

blah blah blah...

We have two build servers set up at the client where I'm at and I'm in charge of keeping them up and running smoothly.

Build Server 1: Local, same office as where our TFS Server is

Build Server 2: Remote, connects via TFS Proxy Server at the remote location which connects to our TFS server (next to Build Server 1)

 

PROBLEM 


The problem is that I recently moved a project using the Move command in TFS.

The project was moved from a location which was incorrect for our Continuous Integration environment to a location that that was optimal.

Between the time that this move occurred and when the project was altered again, a file was dropped from TFS somehow yet it remained in the project. Not a big deal right? I asked a coworker to add it through Team Explorer. Bam, no problem, done. The file was back, it built correctly on our development machines and we went onto the next task.

Then CC.NET Barfed. It was the error that is in red above.

Robert Horvick had some great insight into this error on this post. Here's what he says:

"At a high level what is happening here is that there are two distinct items which happen to have the same path name (at different points in time, obviously).  When you are labeling TFS sees what you want to put into the label (the new item) and what is already in the old label (the old item) and sees the name conflict.  Since /child:replace means to replace the label on the same item it can't drop the label off the old item which means it can't add it to the new item so it issues this error message."

THANK YOU Robert.

 

SOLUTION


As Robert also stated in that post we have to "unlabel" the file so CC NET can re-label it correctly. We're getting rid of the old label on this file. We do this with the "tf unlabel" command.

tf unlabel 1234 "$/Path/to/myFile.cs"

(where 1234 is the label)

I did this, and then forced a build through CC.NET and it worked! Woo hoo!

UNTIL... the next build, it broke, and I get the same exact error message above.

 

After some research I came to find out that this solution that was getting labeled was a solution that was getting labeled multiple times a day on two separate build servers. We have a common source solution that is shared among many applications (such as security objects, loggers, etc). So while I cleared the label on the one build server, there was still a label that might have been newer on the new build server.

In order to get around this, I had to clear all the labels for that file. Normally this is not something I'd ever want to do, but fortunately this file only had about 4 labels applied to it as it was fairly new and we were not doing anything with those said labels (just cc.net labels). After removing the labels, everything started building just fine.

#    Comments [0] |

TFS Build Not Publishing Web Applications

_PublishedWebsites does not exist?! WHAT?! Huh?

One of our TFS builds was succeeding and a fellow developer noticed that the Web App was not getting copied into the _PublishedWebsites folder of our drop location.

I took a look at our TFSBuild.Proj file and I didn't see anything that stood out. I took a look at a similar project who's output was being copied into the _PublishedWebsites directory and the .proj file matched that of the one that did not work.

Solution

The problem was not in the .proj file, but in the actual .csproj file for the Web Applicaiton Project.

.csproj files ARE MSBuild files and inside of that I saw this:

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!--<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0WebApplications\Microsoft.WebApplication.targets" />-->

The second Build target file was not getting loaded.

This build target file contains a target by the name of "_CopyWebApplication" which takes the output of the web application and copies it to the _PublishedWebsites directory.

I uncommented this line, checked it back into TFS and re-ran my build and my _PublishedWebsites started showing up. :)

My file now looks like this:

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0WebApplications\Microsoft.WebApplication.targets" />
#    Comments [3] |
 Monday, January 07, 2008

Sending Email in a Development Environment without an SMTP Server

Sometimes I'm not at a client location and I cannot check to make sure that an email component is working correctly. This results from not having the email server at my disposal to relay the message off of. I also run Vista, which does not come with an SMTP server.

 

Therefore my setting in the App.config wont work for development.

Here's what the settings look like at the client location:

  <system.net>
    <mailSettings>
      <smtp>
        <network host="mail.example.com"/>
      </smtp>
    </mailSettings>
  </system.net>

 

So, while I'm developing remotely I will change the configuration to this 

  <system.net>
    <
mailSettings>
      <
smtp deliveryMethod="SpecifiedPickupDirectory">
        <
specifiedPickupDirectory pickupDirectoryLocation="c:\temp\maildrop\"/>
      </
smtp>
    </
mailSettings>
  </
system.net>

 

What this setting will do is create the email file and drop it into the c:\temp\maildrop\ folder. This setting can be used if you have your SMTP server watch a directory for new mail and it will then send it, or you can use it like I am - for testing when I need to view the email without actually sending it.

Now, when I send an email, like this:

 

        [Test]
        public void SendMail()
        {
            SmtpClient smtpClient = new SmtpClient();
            MailMessage mailMessage = new MailMessage("from@example.com", "to@example.com");
            mailMessage.Subject = "This is a test";
            mailMessage.Body = "This is the body";
            smtpClient.Send(mailMessage); 
        }

 

The mail message will get generated to c:\temp\maildrop\ . Visit this location with Explorer and you'll see something similar to this:

image

 

Now open this .eml file with any text editor (I prefer Notepad++) and you will see the contents of your email.

 

Email Contents

x-sender: from@example.com
x-receiver: to@example.com
mime-version: 1.0
from: from@example.com
to: to@example.com
date: 7 Jan 2008 18:24:10 -0700
subject: This is a test
content-type: text/plain; charset=us-ascii
content-transfer-encoding: quoted-printable

This is the body

 

Now you can test the email functionality of your application without actually having a SMTP Server.

Note: If  you're using ASP.NET you will need to allow ASP.NET to write to the pickupDirectoryLocation.

#    Comments [3] |
 Wednesday, January 02, 2008

About Me

About Me - Who are you and what have you done?

My name is Donn Felker. I work as a Senior Consultant for Statêra, a Microsoft Gold Certified Partner in Phoenix, Arizona. I’m an experienced Software Architect with over 8 years of professional experience in various markets that include – entertainment, health, retail, insurance, financial, and real estate. I write, present and consult on various topics ranging from architecture to agile practices to patterns and practices. I find that I really enjoy mentoring developers who have a passion to learn in a collaborative environment. I am also a part of the open source Tree Surgeon project which helps developers set up “scaffolding” for a new project in .NET, similar to Rails.

Have an idea or opinion you’d like to discuss? Let’s talk about it! I’m always open to learn something new from anyone who is willing to talk!

So what is my history?

Prior to my days at Statêra I worked for RVI Group, the world’s largest residual value insurance company in Stamford, CT. Previous to RVI Group, I worked for Televerde a market intelligence company located in Phoenix, Arizona. While at Televerde I was introduced to a wide array of development and infrastructure challenges that I had never encountered before and in doing so I was introduced into some of the same technologies that I use to this day. I honestly feel that my “ALT.NET” roots were germinated at Televerde. My time at Televerde has ended up being the most influential experience in my career. Before Televerde I worked for Todd McFarlane Productions for many years. I implemented many mission critical systems that still serve this company to this day. At Todd McFarlane’s company I was in charge of various projects ranging from audio production, video production, software engineering, graphic design and network infrastructure. Being involved with such a vast array of highly creative individuals (toy sculptors, comic book artists, designers, and Todd himself) and projects I have been able to supply highly successful solutions to many vertical markets in the entertainment industry. Previous to Todd McFarlane Productions I worked at Target Corporation as a Unix Tech/Developer, Team Trainer and Senior Technical Support Representative. Target was a great place to work mainly because the vast culture the company provided. The Target corporation always had someone who had experience with anything you could shake a stick at, and the best part was – they were always willing to mentor you along in your career.

Between the years of 2002 and 2006 I was the Principal Architect for my own consultancy – G9MEDIA. I specialized in working with entertainment industry clients and implemented many media related solutions. A sample of these clients include Atlantic Records, Dreamworks/Universal Records, AFI, Nitro Records, TMP Intl, and a few other small indie labels from around the country. I was one of the first to start implementing fully dynamic Flash solutions utilizing PHP and MySQL data stores. This was prior to the You Tube boom, so this technology was red hot, unfortunately I didn’t know the right people in the right places to make it big in that arena. Oh well!

Now for some things you probably don’t know about me...

- I hated computers until 1997. I couldn’t stand them. I didn’t even know how to turn one on. Then I was introduced into the internet. Hello internet addiction. I was originally introduced to the internet from a girlfriend I had at the time and two weeks later after I got paid I bought my first computer, a 333mhz Hewlett Packard machine. I surfed the web with AOL (don’t flame me, ... it was over 10 years ago, give me a break!). Ever since I sat in front of this first PC I haven’t stepped away from a computer.

- I’m originally from a very small town that is near the base of the Mt. Lassen Volcano in northern California. The name of the town is “Shingletown” (no, I’m not joking). The population when I left in 1997 was 1000 people. The town is moving up though, they even have a Shingletown website now. 1995 website anyone?!

- I’m a certified Motorcycle Mechanic. I attended MMI (now part of UTI). This is actually the reason I ended up in Arizona. The only two options at the time were Orlando, FL or Phoenix, AZ. I opted for Phoenix. When I graduated from MMI I realized I hated working on motorcycles and the pay was garbage. So I went back to school for a Software Engineering Degree.

- I was almost a stock broker at one point. Prior to jumping into the ship to technology I was about 1 week away from taking my Series 7 and Series 63 securities exams. After arguing with a millionaire over 27 cents on his statement for 4 hours and proving him wrong through the use of a basic calculator and elementary arithmetic many times, I realized this wasn’t the industry for me. The customers were just too much to handle for the rewards of the job. Some people love this industry, but it wasn’t for me. I needed more “puzzles” to solve and less non-existent fires to extinguish.

- I used to race Pro-Am motocross in California prior to attending MMI. I was sponsored by Suzuki and many other small companies around the California area. I broke bones and sprained many joints but I kept at it. One afternoon while at a practice session in Marysville Motocross park I came over a jump at over 45 MPH and crashed on the landing. I ended up breaking my leg so badly that I needed multiple surgeries to fix the problems (the leg works just fine now) – but at the time I decided to hang up my racing gear and call it quits. The riding was fun, but I figured I would enjoy walking and playing with my kids’ later in life rather than risking another accident of that magnitude. I still loved motorcycles which is the reason why I attended MMI.

- During my high school years I obtained certification in cabinet making. That’s right boys, I’ve got wicked skills with wood working tools. I’ve created and sold hundreds upon hundreds of Burl Wood Clocks. They look very similar to the clocks on this site. I haven’t created a clock in nearly 10 years, but still it’s something that was part of my life and might end up being a part later in life.

- I’m an avid Mountain Biker and gym rat. I competed in my first mountain bike event ever (a national event at that) - The NOVA National 2006 – and got second. I haven’t competed since but I still do mountain bike quite a bit when I have time. When I’m not mountain biking I go to the gym consistently to stay in shape.

That’s me past to present. Be sure to subscribe to the RSS feed to receive updates on the blog. Thanks for reading.

#    Comments [0] |
 Wednesday, December 12, 2007

Visual Studio Hangs on a Team Foundation Server UNDO Command

image

Ran into a real pain in the @ss today. While working with Team Foundation Server I was refactoring a couple of projects and at one point I needed to "Undo" my changes. This is normally accomplished by what you see on the left.

Well, to my dismay, as soon as I clicked on that button, Visual Studio 2005 would HANG. I mean, it would just stop. The only way to get it to respond (and yes this is odd)  was to go to Task Manager, then right click on the application (on the Applications tab) and then click "Minimize" then click "Maximize" and the app would respond. Unfortunately the "Undo" didn't happen though.

I looked all around the net, and couldn't find anything. I did the following...

devenv /resetskippkgs (didn't work)

devenv /resetsettings (or something like that - anyway - it didn't work)

I also installed hot fixes that seemed to be related to this problem. Didn't work. Reboot - didn't work. Installed last nights updates - didn't work.

I repaired Team Foundation Explorer - didn't work.

As a last resort I decided to take VS2005 back to its clean slate state by firing off this command. This command is kind of hidden and is not supported by Microsoft (details - all the way at the bottom of that link).

Fix: devenv /resetuserdata

MSDN - Disclaimer: you will lose all your environment settings and customizations if you use this switch. It is for this reason that this switch is not officially supported and Microsoft does not advertise this switch to the public through devenv /? command.

After I fired that bad boy off, waited a few minutes and fired up VS2005 and everything worked again. Thank the big baby jeebus for not having to re-install VS2005 or use a MS Support call. 

#    Comments [1] |