Debugging TFS Job Agent Extension


Creating TFS Job Agent was not difficult at all but debugging it was a pain in the nick! :-)

here I explain how to find what the error and how to fix that

Extension not found for TFSJobAgent (ExtensionNotFound)

So first how to know if my job agent succeeded or failed and if it’s failed, why this happen?

How to see this

Open the following link:

http://TFSServer:8080/tfs/_oi/

Click on the job history, if the job failed you will see it here and you can click on the small arrow to see History or DefinitionTFS Job Definition and History

History
TFS Job History Details

Definition
TFS Job Definition Details

In case there is nothing in the history you should see your job on the Job Motoring page as the following:
TFS Job Monitoring

Remember you will need to restart the TFS Job Agent every time you deploy a new version of the dll so the service can load the assembly and this the reason for the fail first time.
Restart TFS Job Agent

Links:

TFS2012: New tools for TFS Administrators

 Identity Synchronization in Team Foundation Server 2010

Deploying SSDT During Local and Server Build


4 years ago, I wrote a post about how to deploy VS DB (Visual Studio Database Project) to your local SQL Server during your local build.

As you may already know that a new version of SSDT (SQL Server Data Tool) has been released with VS 2012 to replace the normal VS DB project that was existing with VS 2010 and of course the deployment changed.

For more information and understadning about SSDT, see this post:
What’s New in TFS 2012?- SSDT (SQL Server Data Tool)

Now we have a feature called publish profile which you can put all your setting in that file and use it afterwards to deploy the DB.

This post has 2 section:

  • Deploy and publish SSDT to local SQL Server during local build
  • Deploy and publish SSDT to a shared SQL Server during TFS Build

Deploy and publish SSDT to local SQL Server during local build

If  you need to work with SSDT for SQL Server 2014, then you will need to install the last SSDT, it’s not included in VS update 3, download SSDT
SSDT for SQL Server 2014

1.Using SqlPublishTask of MSBuild
I edit the SSDT project file as the following:
local publish SSDT


<Target Name="DeployDB" AfterTargets="build" Condition="'$(Configuration)' == 'Local'">
<Message Importance="high" Text="************** Star Deploying DB **************" />
<Message Importance="high" Text="Deploying Project: $(MSBuildProjectDirectory)\$(MSBuildProjectName).sqlproj" />
<Message Importance="high" Text="Deployment Profile: $(MSBuildProjectDirectory)\PublishProfiles\$(MSBuildProjectName).local.publish.xml" />
<MSBuild Projects="$(MSBuildProjectDirectory)\$(MSBuildProjectName).sqlproj" Properties="SqlPublishProfilePath=$(MSBuildProjectDirectory)\PublishProfiles\$(MSBuildProjectName).local.publish.xml" Targets="sqlPublish" />
</Target>

I used some of MSBuild Reserved and Well-Known Properties like $(MSBuildProjectName) and $(MSBuildProjectDirectory), for complete list, click on this link

====================================================================================

2.Using MS Build Command line with SqlPublishTask

MSBuild SqlPublishTask  command line

msbuild /t:build;publish "C:\TFS Source\Model\Calculator\Calculator.DB\Calculator.DB.sqlproj" /p:SqlPublishProfilePath="C:\TFS Source\Model\Calculator\Calculator.DB\PublishProfiles\Calculator.DB.local.publish.xml" 

"$(MSBuildProgramFiles32)\MSBuild\12.0\Bin\msbuild" /t:build;publish "C:\TFS Source\Model\Calculator\Calculator.DB\Calculator.DB.sqlproj" /p:SqlPublishProfilePath="C:\TFS Source\Model\Calculator\Calculator.DB\PublishProfiles\Calculator.DB.local.publish.xml"
  • If we run the MS Build from withing the project path we can use relative paths instead of absolute paths
  • To use MSBuild without path, we need to open Visual Studio command line otherwise we may having this error “exited with code 9009” which means it couldn’t find the MSBuild.exe”, so I will need to use the full path and this is always the case when working with pre and post build events

====================================================================================

3.Using SqlPackage.exe

SqlPackage.exe is a command line utility that automate some of the DB development tasks

We can call SqlPackage as a post build event for SSDT project as the following:

"$(MSBuildProgramFiles32)\Microsoft SQL Server\110\DAC\bin\sqlpackage" /a:publish /sf:"$(SolutionDir)\$(ProjectName)\$(OutputPath)\Calculator.DB.dacpac" /pr:"$(SolutionDir)\$(ProjectName)\Calculator.DB.local.publish.xml"

The .dacpac file is the output of building sqlproject, as the dll is the output of building a class library
====================================================================================

Deploy and publish SSDT to a shared SQL Server during TFS Build

There are many ways too, the SSDT’s team blog create a great post for all ways, for more info, click on the following link:
SQL Server Database Projects and Team Foundation Build

1.Using SqlPublishTask of MSBuild
I will send some MDBuild arguments in the build definition as the following:
TFSBuild-SSDT1

/t:Build;Publish /p:SqlPublishProfilePath=../Calculator.DB\PublishProfiles\Calculator.DB.local.publish.xml

But because my solution has many projects not only SSDT project, which means I build the solution file not the SSDT project file only, this means, the build argument will be sent to each project file in the solution and this gives error with one of the Win Form project as the following:

MSBuild error MSB3021: Unable to copy file C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (4691): Could not copy the file “exe.manifest” because it was not found.

This error will disappear if we only build SSDT, of course I can use other ways like using SqlPackage.exe with custom build but as this is the way I did on my local build, I prefered to be the same on the Build server, so I customize the build as the following

SSDT with TFSBuild

I used 2 editors:

  • Microsoft.TeamFoundation.Build.Controls.BuildProjectListEditor
  • Microsoft.TeamFoundation.Build.Controls.StringListEditor

Which makes me be able to select multiple build project and multiple publish profiles, for more info about Build Editors, see the following post:
TFS Build Editors and Build Process Metadata

Migrating Team Foundation Server 2013 Databases and all Databases in SharePoint 2013 to a New Server


This post could be used for many scenarios as the following,

Scenario 1:
Migrate Team Foundation Server’s SQL Server to another machine, Migrating Team Foundation Server Databases, moving TFS configuration Database to another SQL Server

Following  steps:
Step-1, step-2, step-4, step-5, step-6, step-7, step-8, step-9, step-11, step-13

===================================================

Scenario 2:
Move all databases in SharePoint 2013, Moving SharePoint Content Databases to a New Server, Migrate SharePoint’s SQL Server to another SQL Server, Moving SharePoint to a different SQL server

Following  steps:
Step-1, step-3, step-4, step-5, step-7, step-10, step-12

===================================================

Scenario 3:
Migrating Team Foundation Server Databases and all databases in SharePoint 2013 to a New Server

Following  steps:
All steps

The list of all steps:

  1. Installing MS SQL Server 2014
  2. Stop IIS and all TFS Services
  3. Stop IIS and all SharePoint Services
  4. Share a folder and turn off firewall
  5. Backup DBs and store them on the shared folder
  6. Backup SQL Server Reporting encryption key
  7. Restore DBs to the new SQL Server machine
  8. Remap Reporting DB and restore encryption key
  9. Remap and configure TFS for the new DB server
  10. Remap and configure SharePoint for the new DB server
  11. Start IIS and all TFS Services again
  12. Verify SharePoint DB migration
  13. Verify TFS DB migration
  14. Note-1 DotNet Framework cannot be installed
  15. Note-2 Fix SharePoint error cannot open DB
  16. Note-3 Fix SharePoint error cannot open sites
  17. Note-4 Repair TFS connection with SharePoint
  18. Note-5 Analysis DB backup and restore

 

1-Installing MS SQL Server 2014

2-Stop IIS and all TFS Services

3-Stop IIS and all SharePoint Services

4- Share a folder and turn off firewall

5-Backup DBs and store them on the shared folder

6-Backup SQL Server Reporting encryption key

7-Restore DBs to the new SQL Server machine

8-Remap Reporting DB and restore encryption key

9-Remap and configure TFS for the new DB server

10-Remap and configure SharePoint for the new DB server

11-Start IIS and all TFS Services again

12-Verify SharePoint DB migration

13-Verify TFS DB migration

14-Note-1 DotNet Framework cannot be installed

15-Note-2 Fix SharePoint error cannot open DB

16-Note-3 Fix SharePoint error cannot open sites

17-Note-4 Repair TFS connection with SharePoint

18-Note-5 Analysis DB backup and restore

Configuring Lab Management 2013 for SCVMM 2012 R2 Environments


In this post I will explain with videos how to configure Lab Management 2013 with SCVMM 2012 R2 so we can create and manage SCVMM environments in Team Foundation Server 2013, for more information, visit the MSDN Configuring Lab Management for SCVMM Environments

The following are the steps:

  1. Installing HV and verifying it is working properly
  2. Improving the reliability of WinRM
  3. Installing SCVMM 2012 R2 prerequisites
  4. Creating 2 folders SCVMM Library and SCVMM VMs
  5. Installing SCVMM 2012 R2
  6. Adding Hyper-V Host to SCVMM 2012 R2
  7. Installing SCVMM Admin Console on TFS machine
  8. Configure Lab Management for Team Foundation Server
  9. Installing and configuring Test Controller
  10. Verifying Lab Management and Test Controller Configured successfully
  11. Note-1 Stopping and Starting WinRM with SCVMM
  12. Note-2 Fix SPN that VMM requires were not correctly registered

1- Installing Hyper-V and verifying it is working properly

2- Improving the reliability of WinRM
See how to increase the maxtimeoutms for Windows Remote Management and this is required for Lab Management

3-Installing SCVMM 2012 R2 prerequisites
See how to install System Center Virtual Machine Manager 2012 R2 Prerequisites

4-Creating 2 folders SCVMM Library and SCVMM VMs
Creating one folder for the Library share that will hold templates and VMs and another folder for the deployed VMs

5-Installing SCVMM 2012 R2

6-Adding Hyper-V Host to SCVMM 2012 R2

7-Installing SCVMM Admin Console on TFS machine

8-Configure Lab Management for Team Foundation Server

9-Installing and configuring Test Controller

10-Verifying Lab Management and Test Controller Configured successfully

11-Note-1 Stopping and Starting WinRM with SCVMM
In case you want to stop and start Windows Remote Management with System Center Virtual Machine Manager installed, because we have to stop System Center Virtual Machine Management Agent and start it manually

12-Note-2 Fix SPN that VMM requires were not correctly registered
See the following video if you encounter the following error:

The Service Principal Names (SPNs) that VMM requires were not correctly registered when the VMM management server

TFS Update 4 CTP 2 Features and installation


Microsoft released Visual Studio 2013 Update 4 Community Technology Preview 2 (CTP 2) on September 22, 2014, it includes some new features and bug fixes.

For more information about this release visit the KB: https://support2.microsoft.com/kb/2994375

This post has main 2 sections:

Team Foundation Server Features

  • Web Access can return directly to query results from a detailed view of the query by using a context menu.
  • Web Access can generate an email directly from the work item view by using a new toolbar command.
  • Web Access has a full-screen option to view query results.
  • The free Stakeholder license provides access to the project home page from which Stakeholders can view the backlog, edit items, run work item queries, and many other operations.
  • Agile teams can have up to 999 work items in the first or last column of the Kanban board.
  • Web Access now opens a work item in a new window or tab.
  • You can maximize (or full screen) fields for quick readability when the rich text editor does not have enough space.

Installation and configuration

  • What you need to know before you install
  • How to install and configure.

Team Foundation Server Features

The following is the walk through video

  • Web Access can return directly to query results from a detailed view of the query by using a context menu.

In the Team Web Access if you run a query and open a work-item from the query result, you can get back to the query result from the work-item context menu on the top-right.

9-25-2014 5-56-27 PM

9-25-2014 5-58-17 PM

  • Web Access can generate an email directly from the work item view by using a new toolbar command.

In the previous update 3, you can send email from the context menu only but now you can send email from the work-item tool bar.
image005
9-25-2014 6-29-13 PM

  • Web Access has a full-screen option to view query results.

Now you can full-screen for the query result for better readability

9-25-2014 6-32-19 PM

image011

  • The free Stakeholder license provides access to the project home page from which Stakeholders can view the backlog, edit items, run work item queries, and many other operations.

There is new Access level feature for the Stakeholder that give them more features then the limited level

9-25-2014 6-35-07 PM

  •  Agile teams can have up to 999 work items in the first or last column of the Kanban board.

9-25-2014 6-37-38 PM

  •  Web Access now opens a work item in a new window or tab.

9-25-2014 8-50-03 PM

  • You can maximize (or full screen) fields for quick readability when the rich text editor does not have enough space.

9-25-2014 6-44-48 PM9-25-2014 6-45-29 PM

Installation and configuration

The following is the walk through video

  • What you need to know before you install

This installation not for production and can’t be upgrade, the only purpose for features evaluation and feedback

image023

  •  How to install and configure.

Installation time (20 minutes)

Configuration time (5 minutes)

This installation doesn’t support layout switch, so you will need to install the web installer.

9-25-2014 4-34-11 PM

For the supported switches type tfs_server.exe/?

9-25-2014 4-34-42 PM

TFSConfig Lab /Delete Command


In a previous post, I explained when you should and should not remove Lab Management resources like (Templates, VMs , Environments) for more information click here

In this post I will show and explain the different options for TFSConfig Lab /Delete switch

What will happen if we run the following command:


tfsconfig lab /delete /collectionName:DefaultCollection 

This will remove all lab managements resources from the collection but it will leave them in SCVMM, see the following video:

What will happen if we run the following command with /External switch:


tfsconfig lab /delete /collectionName:DefaultCollection /external

This will remove all lab managements resources from the collection and also remove them from SCVMM and the Hyper-V host, see the following video:

For more information about TFSConfig lab /delete command, click here

TFS259201 the following host group does not contain any logical network Resolve any issue on host group


In Team Foundation Server, if you try to create SCVMM Lab Environment and you encounter the following error:

TFS259201 the following host group does not contain any logical network Resolve any issue on host group

TFS259201

You can solve this issue as the following:
Add logical network as the following:
SCVMM Logical Network

As we can see the created logical network was not associated with network adapterLogical Network assign network adapter

Add a network adapter to the logical network
Assing Logical network