tfsbuild destroy is your friend

Here is what I just got by using this command.

Microsoft (R) TfsBuild Version 10.0.0.0
for Microsoft Visual Studio v10.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Destroy build record for 258141 permanently? (Yes/No/All) all
Destroying 258141… Done
Destroying 1.6.1.0… Done
Destroying 1.6.2.0… Done
Destroying 1.6.3.0… Done
Destroying 1.6.4.0… Done
Destroying 1.6.5.0… Done
Destroying 1.6.6.0… Done
Destroying 1.6.7.0… Done
Destroying 1.6.8.0… Done
Destroying 1.6.9.0… Done
Destroying 1.6.10.0… Done
Destroying 1.6.11.0… Done
Destroying 1.6.12.0… Done
Destroying 1.6.13.0… Done

… …

Why do I need this? It is because all these builds are accidentally generated due to a cyclic automated check-in when I tried to implement an automated version number increment solution based on this perfect post.

What exactly is the root cause of this cyclic check-in and build? The short answer can be located from here. A little bit more detailed explanation is that, the gated check-in will shelve all the files first and then do a build. Then if all succeed, a final check-in will be made; however, the automated check-in to update the version files, will in turn trigger another gated check-in, and again and again, cyclically.

Then why all these builds failed? Shouldn’t they all succeed? It is because, the automated version increment check-in will use the tf command to check-in the files and for a gated check-in, it will return 1 which means “failure” instead of 0 if it succeeds.

Hence, a check-in triggered the gated check-in build, which in turn triggers another check-in which triggers another gated check-in build, again and again…

The result would be a huge list of incomplete builds that consume a lot of build numbers that you want to get back. In this case, tfsbuild destroy would be your best friend.

Till next time,

Advertisements
tfsbuild destroy is your friend

Database.ExecuteSqlCommand

Database.ExecuteSqlCommand is very useful when leveraging Entity Framework 4.1/4.2 Code First model to do the data access or object relational mapping. To make sure your code is bullet proof for SQL injection attacks, you must use the parameterized SQL script when calling this method. Following is an example for this purpose.

context.Database.ExecuteSqlCommand(“delete MasterSmsCampaignCertificateInfo where MasterSmsCampaignGuid = @p0 and CertificateId = @p1“,
    TheCampaignGuid,
    certInfo.CertificateId);

Database.ExecuteSqlCommand

Resuming my blog…

It’s been a while since I quit my dedicated co-located web server and even my personal Live blog was moved to wordpress (meaning dead, because of the GFW Sad smile). It’s also been a while that I have told myself countless times that it is time to record this or that into a web log but since I don’t have one and I have to forget about the writing ideas.

Now, I’m resuming my blog because:

  • Recently, I was trying to look back and consolidate some of the knowledge I gained during a WP7 application development. I found that I can’t even get a clue since most of the knowledge/tricks are scattered into many places in my brain. If I could have them somehow record into a web log, it would be much easier for me to consolidate and write down them into a more formal/organized piece of paper
  • It would be much more helpful if someone else can benefit from them

My posts will cover various areas around technologies, life, and so on. And probably I will use both Chinese and English to write. I’ll see what I can do for this new blog and hope you’ll like it.

Resuming my blog…