Search This Blog

Thursday, March 29, 2007

How to Dock the Vista Toolbars to the Edge of the Screen

I found a way to dock Vista toolbars to the edge of the screen since drag and drop does not work anymore:
1) Create a new folder on the desktop
2) Drag it to on of the edges so it would become a toolbar
3) Right click the toolbar and select the toolbar that you want to show
4) Now you can define the toolbar behaviour (Auto Hide, Alway on Top)

Wednesday, March 14, 2007

How to Get Build Result Details using TFS API - Part 1

In this series of posts I would explain how to use TFS API in order to retrieve build result details as they appear in the build report.


In order to retrieve result details for a build we need to create a BuildStore object. There is an example on how to create a BuildStore object on a previous post: Get Build Changes. The example take into consideration that you have already created the BuildStore object and it is named buildStore.

In this post we will see how to retrive the details under the summary section of the build report. First, we need to get the BuildData object for the build. Here's how to get the BuildData object:

BuildData buildData = buildStore.GetBuildDetails(buildStore.GetBuildUri(teamProject, buildNumber));

Now that we've got the BuildData object we can retrieve the build details that appear in the summary section of the report:

buildData.BuildNumber
buildData.RequestedBy
buildData.TeamProject
buildData.BuildType
buildData.BuildMachine
buildData.StartTime
buildData.FinishTime
buildData.LastChangedBy
buildData.LastChangedOn
buildData.BuildQuality
buildData.LogLocation

On the next post for this series I will explain how to retrieve the details for the "Build Steps" section of the report.

Sunday, February 25, 2007

Start a Team Build Using BuildProgressForm

I found out another way for starting a build using the BuildProgressForm. The BuildProgressForm is the same one used by Visual Studio Team Build intergration for starting a build.




This method is very useful for my tool TFSBuildManger.
Here's an example of how to do so:

BuildParameters buildParameters = new BuildParameters();
buildParameters.TeamFoundationServer = teamFoundationServer; buildParameters.TeamProject = teamProject;
buildParameters.BuildType = buildType;
buildParameters.BuildMachine = buildmachine;
buildParameters.BuildDirectory = buildDirectory;
BuildProgressForm frmBuildProgress = new BuildProgressForm(buildParameters, teamFoundationServer);
frmBuildProgress.ShowDialog();

Wednesday, February 21, 2007

TFSBuildManager UI Change (Tabbed View)

It been a while since my last post. Anyway, I have published a new release of TFSBuildManager under CodePlex. The main and only change for this release is that the UI now supports control of multiple build types simultaneously by using tabs. Hope you would like this change. You can download the new version here. I would appreciate your comments on this change and about the application.

Wednesday, January 31, 2007

TFSBuildManager New Version

I have released a new version of TFSBuildManager. You can download it here. I made some changes to the edit build type form and added some advanced properties that are inherited from the imported Microsoft.TeamFoundation.Build.targets file. There are some other cool features like "Execute Without Get" which actually resumes a build from the compilation point disabling the process of creating a workspace. This feature is very handy when you setup a new build machine and the build fails because of errors regarding the machine configuration and not because of source files. For the full feature list see the release change log.
Enjoy.

Sunday, January 28, 2007

Export Data to Excel Sheet

I have notice that there is a lot of traffic to my Blog because of a post I have about exporting Excel chart to an image. I thought that it would be good to share more stuff about Excel automation in C#. Below you can find a method to export data into excel sheet. This function uses a list view as the data source.


using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;
using System.Drawing;
using ExcelAutomation = Microsoft.Office.Interop.Excel;

namespace ExcelUtils
{
public static class Excel
{
private static void BorderAroundCell(ExcelAutomation.Range CellRange)
{

CellRange.BorderAround(ExcelAutomation.XlLineStyle.xlContinuous,
ExcelAutomation.XlBorderWeight.xlThin,
ExcelAutomation.XlColorIndex.xlColorIndexAutomatic,
Type.Missing);

}

public static void ReportFromListView(string reportName, ListView
listView)
{

ExcelAutomation.Application excelApp = new ExcelAutomation.ApplicationClass();
excelApp.UserControl = true;
CultureInfo oldCultureInfo = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
ExcelAutomation.Workbook workbook = excelApp.Workbooks.Add(Type.Missing);
ExcelAutomation.Worksheet worksheet = (ExcelAutomation.Worksheet)workbook.Worksheets.get_Item(1);
worksheet.Name = reportName;
//Headers
foreach (ColumnHeader columnHeader in listView.Columns)
{
worksheet.Cells[1, columnHeader.Index + 1] = columnHeader.Text;
}
string[] letters = new string[26]{"A", "B", "C", "D", "E", "F", "G", "H",
"I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
"W", "X", "Y", "Z"};
for (int i = 0; i < listView.Columns.Count; i++)

{
string headerCell = letters.GetValue(i) + "1";
worksheet.get_Range(headerCell, headerCell).Font.Bold = true;
BorderAroundCell(worksheet.get_Range(headerCell, headerCell));
worksheet.get_Range(headerCell, headerCell).Interior.ColorIndex = 36;
}
//Content
for (int i = 0; i < listView.Items.Count; i++)

{
for (int j = 0; j < listView.Columns.Count; j++)
{
string dataCell = letters.GetValue(j) + (i + 2).ToString();
worksheet.Cells[i + 2, j + 1] = listView.Items[i].SubItems[j].Text;
BorderAroundCell(worksheet.get_Range(dataCell, dataCell));
}
}
worksheet.Columns.AutoFit();
worksheet.Columns.HorizontalAlignment = ExcelAutomation.XlHAlign.xlHAlignLeft;
excelApp.Visible = true;
Thread.CurrentThread.CurrentCulture = oldCultureInfo;
}
}
}

Monday, January 22, 2007

New Terminals Version (Support for RDP 6.0)

We have published a new Terminals version (1.0 Prodcution). You can download it at here.

Here are the available changes for this release:

1. Support for RDP 6:

  • 32bit color support.
  • Supports screen resolutions of up to 4096x2048.
  • Supports disabling clipboard redirection.
  • Enable smart card redirection.
  • Enable plug&play devices redirection.

2. Save position and size.

3. Nicer about box...

4. Execute before connect (per connection and for all connections).

5. Some additional bugs were fixed.

Enjoy.

Wednesday, January 17, 2007

Company Dashboard

We have installed a 42'' LCD Screen in our company headquarters. This LCD screen will be used for a dashboard displaying stats on our development process. Currently I'm using Excel reports created with TfsWarehouse OLAP cube (I have written about it before and I will post a guide in the future). The Excel reports are processed by a utility I wrote that extracts the charts from the Excel files to images in a directory that is displayed in a web site (I used javascript fade effect for it).

Here are some pictures of the LCD screen:




Monday, January 15, 2007

5 Things That Will Make You Move To Vista

I've started using Windows Vista on my desktop. I like it, it's working smooth and it looks good.
I don't think that moving to Vista is essential but I've decided to work with it and find out what will make me consider moving all of my machines to Vista.
So here are the first 5 features that made me smile:
  1. Start --> Run is dead. Start --> Start Search is the answer to those who won't leave their keyboards. Press the Windows button and start typing for searching programs and files. I did not open the programs group since I've installed Vista. It became useless.
  2. F2. This one made me smile the most. When you press F2 to rename a file the selected text is only the file name without the extension (for those of you that show file extensions). I wonder how long it took to develop this feature?
  3. Search is now part of the Explorer address bar. Just start typing and it show you the results in the same window. Performance is affected by indexing status.
  4. Burn button (Windows Explorer toolbar): Although I like using dedicated programs for CD/DVD burning I found the Burn button very useful. Select files and folders and press the Burn button to burn them.
  5. Restore previous versions (Folder, file context menu): If you will enable in system security Shadow Copies or System Restore you can get previous version of a file, folder. Good backup solution.

To be continued.

Wednesday, January 10, 2007

TFSBuildManager

I wrote a utility to manage build types called TFSBuildManager. You can download it's first release here. It is hosted under CodePlex.
Main features of this utility are:
  • Start, stop a build
  • Change build/s quality
  • Delete, backup build/s
  • Edit build type

I wrote it because I needed the ability to manage build types outside Visual Studio environment. Also, I needed some features that are not available through Visual Studio IDE.

I'm planning to add:

  • Advanced build log
  • Add new Build Type
  • Build list filtering
  • Edit advanced Build Type properties

Enjoy.

Monday, January 08, 2007

Export Excel Chart To Image

I'm working on a dashboard that will display TFS reports. I thought using "SQL Server Business Intelligence Development Studio" for creating reports but found it not so stable. Anyway, I think that using TFS Excel integration for creating reports is the best way (I will write about how to do it in a future post). Now I have some excel reports but I want them to be displayed in our dashboard automatically (soon will be displayed on a 42'' LCD...). The solution for this was to export the excel chart from the report to an image that will be displayed in the dashboard site.
Here's the code to export the image:


using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using Excel = Microsoft.Office.Interop.Excel;
using System.Globalization;
using System.Threading;
using System.IO;

private static void ExportExcelChartToImage(string excelFile, string outputFile)
{

//Object to send in com methods instead of null
object missing = System.Reflection.Missing.Value;
//Create a new excel application
Excel.Application excelApplication = new Excel.ApplicationClass();
//Saving the old culture info
CultureInfo oldCultureInfo = Thread.CurrentThread.CurrentCulture;
try
{
//Setting new culture info is en-us is not default (Disable exception)
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us");
//Open the excel document
Excel.Workbook excelWorkbook = excelApplication.Workbooks.Open(excelFile,
missing, missing, missing, missing, missing, missing, missing, missing,
missing, missing, missing, missing, missing, missing);
//Refresh the data from TFS
excelWorkbook.RefreshAll();
//Taking into consideration that there's only one sheet
Excel.Worksheet activeSheet = (Excel.Worksheet)excelWorkbook.ActiveSheet;
//Again, there's only one chart on the sheet
Excel.ChartObjects chartObjects = (Excel.ChartObjects)activeSheet.ChartObjects(missing);
Excel.ChartObject chartObject = (Excel.ChartObject)chartObjects.Item(1);
Excel.Chart chart = chartObject.Chart;
//Set the filter (bmp, jpg...)
string extension = Path.GetExtension(outputFile).Replace(".", "");
//Export the image
chart.Export(outputFile, extension, missing);
//Save and close the workbook
excelWorkbook.Save();
excelWorkbook.Close(false, excelFile, missing);
}
finally
{
//Set the old culture info
Thread.CurrentThread.CurrentCulture = oldCultureInfo;
//Close and free the excel application
excelApplication.Quit();
excelApplication = null;
}
}

Tuesday, January 02, 2007

Get List of Builds for Deleted Build Types

To get a list of builds you can use:

BuildData[] GetListOfBuilds(string teamProject, string buildType)

How to get build types list I have mentions in: How to Get Build Types List.
If you deleted a build type and you want to get list of builds from this type then you need to call GetListOfBuilds with String.Empty as the buildType parameter. This will return a full list of builds for the teamProject.

public BuildData[] GetAllBuilds(string server, string project)
{
TeamFoundationServer tfs = new TeamFoundationServer(server, CredentialCache.DefaultCredentials);
tfs.EnsureAuthenticated();
BuildStore bs = (BuildStore)tfs.GetService(typeof(BuildStore));
return bs.GetListOfBuilds(project, String.Empty);
}

Thursday, December 28, 2006

Get Build Changes (ChangeSetData, Changeset, Change)

To improve our custom build report that I have talked about before (Custom Build Logger) I wanted to add information regarding the users that are involved in this build and the changes that they made to source control.
Here's an example how to go over build changes:


using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
using Microsoft.TeamFoundation.Build.Proxy;

TeamFoundationServer tfs = new TeamFoundationServer(server);
VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
BuildStore bs = (BuildStore)tfs.GetService(typeof(BuildStore));
ChangeSetData[] changeSetsData = bs.GetChangeSetsForBuild(bs.GetBuildUri(project, buildNumber));
foreach (ChangeSetData changeSetData in changeSetsData)
{
//Here you can do something with the ChangeSetData properties
//changeSetData.CheckedInBy...
//Get the ChangeSetData Changeset
Changeset changeSet = vcs.GetChangeset(changeSetData.ChangeSetId);
//Go over the Changeset changes
foreach (Change change in changeSet.Changes)
{
//Here you can do something with the Change
//change.Item.ServerItem...
}
}

Monday, December 25, 2006

File was rejected by digital signature policy (VS 2005 SP1 Installation)

I'm installing Visual Studio 2005 SP1 on our servers and I got this error while running the installation. It seems to be a memory issue while trying to verify the package. Here's a KB that that was suppose to help solving the problem: http://support.microsoft.com/kb/925336. Here's a detailed guide:
1) Open Administrative Tools -> Local Security Policy.
2) Click the "Software Restriction Policies" item on the left tree. If you see on the right side of the window a message that says: "No Software Restriction Policies Defined" then you need to right click the "Software Restriction Policies" item on the left side of the window and select "Create New Policies". Look at the screen shot below:



3) After doing this (or you did not have to), double click the "Enforcement" item in the right side of the window. In the new opened window select the "All users except local administrators" radio button. and apply the changes. Take a look at the picture below:





4) After doing all those still I had the same error. I searched and found another post (http://blogs.msdn.com/heaths/archive/2006/09/22/Enabling-Large-Patches-to-Install.aspx) regarding big patches installation and followed these steps:

Set the DWORD value PolicyScope to 1 in the HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Safer\CodeIdentifiers key. Run "net stop msiserver" (without quotes). Install the EXE or MSP (if you extracted the MSP from the EXE).

Don't forget to set it back to the old value.

This helped me solve the issue and after few hours of struggling I finished installing the patch. I don't know if you need to do everything I mentioned. Maybe you can apply the last one only and it will work.

Thursday, December 14, 2006

As I mentioned before, yesterday, I spoke at the Team System event is Israel. I have joined SRL to a lecture on Configuration Management and Build Enhancements. It was a pleasure sharing the knowledge. Here I am:






Tuesday, December 12, 2006

Drag and Drop Files Order

Check out this interesting question on Yedda


Yedda - People.Sharing.Knowledge.WinAmp 5.32: playlist

I love Winamp and I've been using it since version 2 I think, but there's one problem with it that I keep getting: when I drag files from Windows Explorer to the Winamp playlist, the order of the files changes. When will they fix it?

Topics: , ,

Asked by hubble on December 11, 2006

View the entire discussion on YeddaYedda - People.Sharing.Knowledge.




Check out this interesting answer on Yedda


Yedda - People.Sharing.Knowledge.WinAmp 5.32: playlist

Actually, it's a windows and not WinAmp issue. If you'll do this with Windows Media Player you'll get the same result. I even wrote an application once that had the same behaviour. The reason it happens is that when you start dragging windows consider the file that the mouse cursor is pointing on as the first one in the list. If you will point to the first file in the list you will get the list as it should be but probably (and naturally...) you are pointing to the middle of the list and the files are added not as you wished.

Hope I helped.

Topics: , ,

Answered by dudushmaya on December 11, 2006

View the entire discussion on YeddaYedda - People.Sharing.Knowledge.


Monday, December 11, 2006

Microsoft Team System Event in Israel

I'm going to speak this Wednesday at the Annual Microsoft Team System Event in Israel. I will talk about how we see Team System in our organization and present some of the enhancements we did.
Team System Rocks!!! Spread the word...

Wednesday, December 06, 2006

Custom Build Logger (ILogger)

Developers were complaining that the build log (Build.log) is too complicated to read and they only want so see the log when the build fails and why.

The first thing I though doing was to write a log reader. Wrong!!! I googled "team build logger" and found this page: http://blogs.msdn.com/gautamg/archive/2006/04/19/578967.aspx which explains how to write a custom build logger (by implementing ILogger interface). I was already familiar with this interface and used it once while writing an MSBuild script executer. The important stuff from this blog was that you can register a custom logger for a team build by adding a line to the TFSBuild.rsp for the build type (/Logger:LoggerClassFullName, AssemblyFileName ).

So, I've implemented a new logger which captures build errors and send them at the end of the build to developers. The thing is that failed tests are treated as warning and do not fail the build (The log view in Visual Studio captures the warnings and mark the build as failed). The worse thing is that there is not logging regarding the failed tests. So we are back where we've started with a log that only says that the tests failed. The next step to try and solve this issue was finding the trx files and parsing them for the test results. In the code below you can see how I did it. Ignore the whole code just look at the SelectNodes and SelectSingleNode lines which retrieve the errors from the trx file. You can download the sources from here. Thank you Eyal for the free hosting... To make it work you need to update the config file with your settings and add the line: /Logger:BuildLoggers.ErrorsMailLogger, BuildLoggers.dll to the TFSBuild.rsp file.

XmlNodeList xmlNodeList = testResultsXmlDoc.SelectNodes("//UnitTestResult[errorInfo]");

xmlNode.SelectSingleNode("testName").InnerText

xmlNode.SelectSingleNode("errorInfo").SelectSingleNode("message").InnerText

xmlNode.SelectSingleNode("errorInfo").SelectSingleNode("stackTrace").InnerText

Clarizen Secures $7 Million in First-Round Funding Co-Led by Benchmark Capital and Carmel Ventures

We had a nice press release yesterday. You can read it here: http://www.prnewswire.com/cgi-bin/stories.pl?ACCT=104&STORY=/www/story/12-04-2006/0004484503&EDATE=.
Some other article regarding Clarizen:
http://www.themarker.com/tmc/article.jhtml?ElementId=gg20061204_989865&strToSearch=%F7%EC%F8%E9%E6%EF - Hebrew
http://www.degardener.com/2006/12/05/clarizen-is-a-first-in-a-number-of-ways/

Wednesday, November 29, 2006

Another Terminals Version

Again, we have published a new Terminals version. This time we've added a cool feature called: Desktop Share. With this feature you can define a share (should be to your desktop) on the terminal server. When you drag and drop files to your terminal server window those files will be copied to that share. It's a little trick to support easy file copy to the server. If you would like to enable copy and paste of files between the client and the server you can read: HOW TO: Securely Copy and Paste Files Between the Terminal Services Client and the Terminal Server in Windows 2000.