Archive

Posts Tagged ‘ALM’

PackageWeb Zip Error DestinationFiles refers to 2 item(s), and SourceFiles refers 1


Today I got this error while publishing my web and wcf application in Visual Studio 2013 using PackageWeb Zip Nuget package.

Error “DestinationFiles” refers to 2 item(s), and “SourceFiles” refers to 1 item(s). They must have the same number of items.

This error was generated by the PackageWeb.ZipExtension.targets under the -Package folder specifically by the following statement

<Copy SourceFiles=”$(_ZipPs1)”
DestinationFiles=”@(_PkgLoc->’%(rootdir)%(directory)Zip-Interactive.ps1′)”
Condition=” ‘@(_PkgLoc)’ != ” “/>

I added the Message task before the copy task to view the value of _PkgLoc

<Message Text=”***_PkgLoc:@(_PkgLoc->’%(rootdir)%(directory)'” Importance=”high” />

For some weird reason, the _PkgLoc list had two identical items.  

***_PkgLoc:c:\publish\;c:\publish\

To fix this error I added the KeepDuplicates attribute to the _PkgLoc tasks as follows:

<ItemGroup>
<_PkgLoc Include=”$(DesktopBuildPackageLocation)” Condition=” ‘$(DesktopBuildPackageLocation)’!=” ” KeepDuplicates=”false” />
<_PkgLoc Include=”$(PackageDestinationRoot)” Condition=” ‘@(_PkgLoc)’==” ” KeepDuplicates=”false”/>
</ItemGroup>

I am not the expert when it comes to MSBuild. If you have a better way to handle this, you can add a comment below

Categories: ALM Tags: , , ,

Visual Studio 2012 Update 4 RC3


Visual Studio 2012 Update 4 RC3 is out. You can downloaded from

http://www.microsoft.com/en-us/download/details.aspx?id=40263

Check out this link for the update description

http://support.microsoft.com/kb/2872520/en-us

Install instructions

  • Visual Studio
    • VS2012.4 RC.exe
  • Team Foundation Server (Choose either Web Installer or ISO Image)
    • Web Installer: tfs_server.exe
    • ISO Image: VS2012.4 RC TFS Server ENU.iso
  • Team Foundation Server Express (Choose either Web Installer or ISO Image)
    • Web Installer: tfs_express.exe
    • ISO Image: VS2012.4 RC TFS Express enu.iso
  • Visual C++ Redistributable (Choose architecture: x86, x64, arm)
    • vcredist_x86.exe
    • vcredist_x64.exe
    • vcredist_arm.exe

TFS 2012: Set Default Task Activity in the Scrum Template


There is no option to do so without modifying the Task workitem template.

  • You need to install the TFS 2012 Power Tools

http://visualstudiogallery.msdn.microsoft.com/b1ef7eb2-e084-4cb8-9bc7-06c3bad9148f

  • Open Visual Studio 2012
  • Click on Open WIT from Server

image

  • Select Task to modify the Tasks template

image

  • Click on Edit on the Activity field. At this point we want to know the valid values

image

  • Select SuggestedValues and click on Edit
  • You should see a list of the valid values
  • Close all the dialogs to get back to the previous screen shot

image

  • Click on the Workflow tab
  • Right click on ToDo and click on Open Details

image

  • Click on the new Button
  • Select Microsoft.VSTS.Common.Activity from the drop down

image

  • Click on the Rules tab
  • Click on the New Button
  • Select DEFAULT

image

  • Select value from the From combobox and type Development in the Value field

image

  • Click OK to close the Default dialog
  • Click OK to close the workflow State Field Rules dialog

image

  • click the save button.

image

  • Create new Task from Visual Studio or Web Access

image

TFS2012: Create Build Definitions


Introduction

In this article I will explain how to create a build definition in the Visual Studio 2012 and TFS 2012 server. I used TFS 2012 Express when I wrote this post. In a previous post, I went through the build types that Team Foundation Server supports.

To run a Team Build in TFS, assuming you already setup the Build Controller and Agents, you need to create a build definition. A build definition acts as a settings or configurations file for the build process.

Create Build Definition

The following steps show how to create a team build definition:

Open Visual Studio 2012

Open Team Explorer (View—>Team Explorer)

Connect to a TFS Server and Team Project

image

After you are connected to the Team Project of interest, go back to the Home menu or page and click on the Builds link

image

Click New Build Definition to create a new build definition

image

Give your build definition a meaningful name (e.g. mypp-CI-Debug, myapp-Scheduled-UnitTests).

Queuing process option is sufficiently explained on the screen.

image

Click on the Trigger node

On this screen, you can specify the build type. Build types were covered in the previous article. Under Rolling builds, Build no more often than ever x minutes means you want at least x minutes between builds to allow for build accumulation. Under Gated Check-in, check the Merge and build up to x submissions, if you want to group submissions when building them to improve performance.

image

The next step is to configure the Workspace.

On this screen, you can select as many folders as you want. Those folders and their contents will be downloaded (Get performed) to the Source Directory to the code. As a best practice, you want to avoid referencing the root folder of you team project (e.g. $/MyTeamProject) because you want to avoid getting the code for unrelated files or projects. Point to the folder where your code exists and add other folders for other related code or libraries such as libraries for third party controls. When adding multiple folders, make sure you maintain the folder level or relative path among folders at the Build Agent Folder.

image

Click on the Build defaults, it is probably called with that name because you can override these values when you queue a build <— I am guessing 🙂

On this screen, you have to specify a Build a controller and the drop folder location. The drop folder contains the output of the build process.

image

The Process screen is where you can define the Build process Template, which is a workflow of activities to execute your team build, and the Build process parameters that are passed to the workflow build template as arguments.

image

If you are using the Default Template, you need to at least populate the Items to Build parameter with a solution. Deferent build templates may have deferent parameters. You can also create and customize a build template.

Click the ellipsis button

Click on Add

Select a solution

You can select multiple solutions

You can set the configurations for the build in the Configurations tab

image

In another post, I will explain the other parameters.

The last step, is to define the retention policy. The retention policy automate the deletion of old builds to save disk space.

Save the build definition

Notice that it will be added to the build definition section on the build window. To queue a build manually, right click and click on Queue New Build

image

TFS2012: Run Concurrent Sprints


This post is in response to the following forum question http://social.msdn.microsoft.com/Forums/en-US/tfsgeneral/thread/9b9c6479-34f8-427f-b461-09f8b6a3c8f9

In the post, I will show how to show two backlogs for a Release 1 and Release 2. Backlogs will NOT be visible at the same time.

Open TFS Web Access

Click on Configure Schedule and iterations

image

I have two releases two sprints in two different releases. In real case scenario, a later Sprint than Sprint 1 will be the current Sprint for Release 1

image

Click Set as team’s backlog iteration for Release one to show workitems assigned to Release 1 in the backlog

image

Close the popup

Click on View backlog

image

Notice that you can only see the backlog items assigned to Release 1

One of the issues you will have is when you view the backlog, the Iteration path is not one of the visible columns. It is useful to show the Iteration Path in the grid. Click on Column Options and add the Iteration Path from the left rest to the right one.

image

To show the backlog for Release 2. Click the home button and click on the configure schedule and iterations. You can select Release 2 now.

image

Make sure you check Sprint 1

image

In the steps, I will be adding a workitem query to the team favorites to show the number of the workitems assigned to a Release. Go to the Work tab then Work Items. lick on the Product backlog. Click on the editor tab then modify the iteration path then click on the Save as Query button. I am calling it PBL-Release1.

image

Create another query for Release 2.

Click on the little triangle next to the the new queries and add them to the team favorites

image

Notice that the queries got copied to the team favorites section

image

Go to the home page and notice the new tiles

image

Categories: ALM, TFS2012 Tags: , , ,

TFS2012: Run Data Driven Unit Tests in TFS Team Build


In a previous post, I explained how to run one test method twice using the data driven approach with Excel workbook as a datasource. The solution worked without issues when running using Visual Studio 2012. But I wasn’t able to run the unit tests using TFS Team build. I was getting the following error

The unit test adapter failed to connect to the data source or to read the data. For more information on troubleshooting this error, see “Troubleshooting Data-Driven Unit Tests” (http://go.microsoft.com/fwlink/?LinkId=62412) in the MSDN Library. Error details: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

image

The following is my setup:

3 VMS

Active Directory: Windows 2008 R2

TFS 2012 Express: Windows 2008 R2, SQL Server 2012 Express

Team Build Server: Windows 2008 R2, Team Build Controller and 1 Agent running as NT Authority\ Network Service

Troubleshooting Steps

Check if the Excel file is copied to the Out folder

In my case it was copied

image

Check if you have the proper drivers installed

 

In my case I had make sure that the ODBC driver for Excel xlsx files is installed. There are two versions of ODBC Datasource: 32bit and 64bit. To learn more about that topic checkout this KB http://support.microsoft.com/kb/942976

I opened both the 32bit and 64bit versions of the odbcad32.exe on the build machine and I noticed that the drivers were installed for the earlier version of Excel (xls) and not the 2007+ version (xlsx).

image

The reason it was working in Visual Studio (local machine) is I had Office 2010 installed on the machine that has Visual Studio.

I logged on as lab\administrator (domain admin rights) and then I Installed Office 2010

Now I opened the ODBCad32 and found out that the driver is installed and the DSN is added to the User DSN.

image

 

image

 

If I run the team build now, I will fail with the same error because the service is running as Network Service not lab\Administrator

Change the Run as account

Open the TFS Admin console from the build machine

Click on Build Configurations Node

Stop the Build Service

Click on Change in the Run the Service as groupbox

Select User a user account

WARNING: You MUST NOT use a domain admin for your run as service. I will change it later on in the article. The reason I am using a domain admin here is because I installed office using that account. The office installation adds the DNS names for at the user level which only accessible to the current user. I will show it to you working first then I will change the account.

Enter your username. If you keep the “User the same identity as Windows Service” checked, TFS will add this account to the Project Collection\Project Collection Build Service Accounts group. You can use a local machine admin account in the first box and a domain user with limited privileges in the Connect to TFS as box as I will show later on.

image

Click OK and Save.

Queue a team build

image

Replace Run as Service Account

Now I will replace the the run as Service Account as a local Administrator

Open the TFS admin console from the build machine

Build Configuration—>Service Property—>Stop the service

Click the change button

I am using a local admin account. If you template interact with other network computers you need to use a domain account.

image

Uncheck Use the same identity as windows Service

Click the Change button

Enter the account information. This account will be used for any interaction with TFS

image

Click and Start

Queue a new build

The build should fail with same error we had above.

image

I am getting this error because the installation of Office 2010 added the DNS name to the User DNS which means it is only available to the the current user. You can fix this issue by logging on as your new account and add the DNS to the User DNS tab.

Add Excel DNS to the Local DNS list

Log on as the new user (I am logging on as LocalAdmin). You can also run the Odbca32.exe as a different user if you don’t want of log off and on.

Open “C:\Windows\SysWOW64\odbcad32.exe”

In the User DNS

Click Add

image

Select Microsoft Excel Driver (the one that contains xlsx)

Click finish

Name it Excel Files

Click OK

Run the build again and it should pass

TFS2012: How to delete a workspace using the tf command


Today while I am writing another blog post, I encountered the following error

Exception Message: The working folder C:\Builds\5\MyTeamProject\UnitTestProject1\src is already in use by the workspace 6_5_TFS2012Build1;TFS2012BUILD1$ on computer TFS2012BUILD1. The Build Agent TFS2012Build1 – Agent1 is running as a different user Administrator and local paths can only be mapped to a single workspace. To resolve this issue, you can configure the Build Service to run as the user who owns the conflicting workspace, or you can delete the workspace using the ‘tf workspace’ command. (type WorkingFolderInUseException)

I received that error because, I changed the run as service account for the Build Controller. From a machine that has Visual Studio installed, open the VS command prompt.

Then, the first thing you want to do is check what switches TF workspace has by running the following command


tf workspace /?

To learn more about the switches or arguments, check this msdn article http://msdn.microsoft.com/en-us/library/y901w7se(v=vs.100).aspx

You can also use the tf workspaces to target multiple workspaces or to list all workspaces for a collection


tf workspaces /collection:http://tfs2012express:8080/tfs/defaultcollection Collection:http://tfs2012express:8080/tfs/defaultcollection

The above will return you the workspaces on the current machine. If you want to view all workspaces, you need to use the /computer switch


tf workspaces /collection:http://tfs2012express:8080/tfs/defaultcollection Collection:http://tfs2012express:8080/tfs/defaultcollection /computer:*

image

In my case, I am using the following switches


tf workspace /delete /collection:<a href="http://tfs2012express:8080/tfs/defaultcollection 6_5_tfs2012build1;tfs2012build1$

image

Type Yes and press enter