21 October 2013

Updating the Microsoft TFS 2012 and Project Server 2013 VM to TFS 2013

I've recently had to perform an update to my copy of the Microsoft-provided Team Foundation Server 2012 and Project Server 2013 virtual machine

The virtual machine is running TFS 2012.1, SQL Server 2008 R2 Enterprise and Project Server 2013. Also, SQL Server Reporting Services was not needed for the demos performed on this VM, so it was never configured. Unfortunately, the upgrade can't complete successfully if SSRS isn't working. Given this configuration, there are a few prerequisites steps needed.

Login

First off, login to the VM using the Administrator account (password: P2ssw0rd)

Configure SSRS

  • This is as easy as running the Reporting Services Configuration Manager program and starting the service.

SNAGHTML42f557

  • Now go to the Web Service URL tab and click the Apply button to configure the web service.

image

  • We need to do the same thing on the Report Manager URL page. Click the Apply button here too.

image

  • We need to setup the database on the Database tab.  Click the Change Database button. In the Report Server Database Configuration Wizard, select Create a new report server database then click Next.

image

  • We are going to keep all of the defaults in this wizard, so just keep clicking Next, Next, Next. You will finally get configured, so click Finish to close the wizard.

image

  • The Database tab should now show the configured database and credentials.

SNAGHTML55f91e

Update SQL Server

TFS 2013 does not support SQL Server 2008 R2 so we need to upgrade the database in-place.  To do this, just grab your copy of SQL Server 2012 Enterprise with Service Pack 1 and run an Upgrade.

Note: Make sure you use the Enterprise version of SQL Server 2012 since the existing installation is Enterprise.

Upgrade TFS 2012.1 to TFS 2012.3

TFS 2012 Update 1 was a bit buggy, so I always recommend that folks go to the latest Quarterly Update before jumping major versions. This step will get the TFS databases upgrade and stable before we install TFS 2013.

As of this writing, TFS 2012 Update 3 is the latest releases version.  Just grab the Update and run it on your server. Nothing special here.

Note: You are going to need the ISO (1.1gb) for this step and the next, so download that file instead of the Web installer (743kb).

Update the Project Server Extensions  to TFS 2012.3

Install the Project Server Extensions for TFS 2012.3 from the ISO you downloaded for the last step.

c16f004

Uninstall TFS 2012.3 Project Server Extensions

Yes, I know we just installed these, but that was to make sure the databases were all set.  With that done, we need to get these bits off the server so we can put down the 2013 bits.

Go to Add/Remove Programs and uninstall the Project Server Extensions.

Uninstall TFS 2012.3

Again, we need to clear out the old bits to make room for the new bits.  In Add/Remove Programs uninstall Microsoft Team Foundation Server 2012.

Install TFS 2013

Now we are ready to install TFS 2013.  This is a simple install.  When the installer is done, run the Upgrade Wizard to upgrade your databases.  Remember, the password is always P2ssw0rd.

Install the Project Server Extensions for TFS 2013

Just like in the 2012 case, these bits are on the TFS 2013 ISO disk in the Project Server Extensions folder.  Just run it and take the defaults.

That’s it!

You should now have a fully functional TFS 2013 with Project Server 2013 virtual machine to play with. Enjoy!

16 August 2013

TFS 2012 – My warehouse jobs are supposed to be running but show QueuedScheduled

trucks

I just finished a very stressful couple of days.  I was working with a client to upgrade their TFS 2010 installation to TFS 2012.3.  During the process we had a couple of issues to resolve, but one of them was blog-worthy.

The stress came from the fact that if we couldn’t resolve these issues we would have to rollback the entire upgrade to TFS 2010. That would negate two weeks of work and probably have an very unhappy client.

Problem

After getting the customer’s system upgraded we noted that their warehouse wasn’t processing.  Strangely, when we launched the Warehouse Controller Web Service on the App Tier machine we saw that there were lots of jobs that had CurrentRun entries that showed a JobState of QueuedScheduled.

Notice that the Build Warehouse Sync job on Line 26 & 27 is showing a JobProcessingStatus of Idle, but the job’s CurrentRun element on lines 40&41 are showing that the job is running but in a QueuedScheduled JobState.  This makes entirely no sense.  The Job is running but it queued so it’s Idle?

   1:  <?xml version="1.0" encoding="utf-8" ?>
   2:  <WarehouseProcessingStatus 
   3:       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   4:       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   5:       xmlns="http://schemas.microsoft.com/TeamFoundatio...">
   6:    <RequestTimeUtc>2013-08-16T14:01:26.4000423Z</RequestTimeUtc>
   7:    <WarehouseProcessingOnlineStatus>Started</WarehouseProcessingOnlineStatus>
   8:    <AnalysisProcessingOnlineStatus>Started</AnalysisProcessingOnlineStatus>
   9:    <JobProcessingStatus>Idle</JobProcessingStatus>
  10:    <JobsRunning>0</JobsRunning>
  11:    <JobsQueued>6</JobsQueued>
  12:    <Instance Name="TEAM FOUNDATION"
  13:               JobProcessingStatus="Idle"
  14:               JobsRunning="0"
  15:               JobsQueued="1">
  16:      <Jobs>
  17:        ...
  18:      </Jobs>
  19:    </Instance>
  20:    <Collections>
  21:      <Collection Name="DefaultCollection"
  22:                   JobProcessingStatus="Idle"
  23:                   JobsRunning="0"
  24:                   JobsQueued="5">
  25:        <Jobs>
  26:          <Job Name="Build Warehouse Sync" 
  27:               JobProcessingStatus="Idle">
  28:            <LastRun QueueTimeUtc="2013-08-16T01:52:33.423Z"
  29:                      ExecutionStartTimeUtc="2013-08-16T02:15:11.017Z"
  30:                      EndTimeUtc="2013-08-16T02:15:12.123Z"
  31:                      Result="Blocked">
  32:              <ResultMessage>
  33:                [Build Warehouse Sync]: ---> TF221107: Reporting for
  34:                Team Foundation Server cannot execute job Build Warehouse Sync
  35:                for team project collection DefaultCollection because the 
  36:                warehouse is offline. Use the Team Foundation Administration 
  37:                Console to start reporting.
  38:              </ResultMessage>
  39:            </LastRun>
  40:            <CurrentRun QueueTimeUtc="2013-08-16T13:55:00.45Z" 
  41:                        JobState="QueuedScheduled" />
  42:          </Job>
  43:   
  44:          ...
  45:   
  46:          <Job Name="Work Item Tracking Warehouse Sync" 
  47:               JobProcessingStatus="Idle">
  48:            <LastRun QueueTimeUtc="2013-08-16T01:52:33.423Z" 
  49:                     ExecutionStartTimeUtc="2013-08-16T02:15:11.017Z" 
  50:                     EndTimeUtc="2013-08-16T02:15:12.123Z" 
  51:                     Result="Blocked">
  52:              <ResultMessage>
  53:                [Work Item Tracking Warehouse Sync]: ---> TF221107: Reporting 
  54:                for Team Foundation Server cannot execute job
  55:                Work Item Tracking Warehouse Sync for team project collection
  56:                DefaultCollection because the warehouse is offline. Use the
  57:                Team Foundation Administration Console to start reporting.
  58:              </ResultMessage>
  59:            </LastRun>
  60:            <CurrentRun QueueTimeUtc="2013-08-16T13:55:00.45Z" 
  61:                        JobState="QueuedScheduled" />
  62:          </Job>
  63:        </Jobs>
  64:      </Collection>
  65:    </Collections>
  66:  </WarehouseProcessingStatus>

Digging a little deeper, we jumped down to the Event Viewer on the App Tier machine. 

In case you are not aware, TFS has it’s own section to collect debugging records. These can be found in the Event Viewer | Applications and Services Logs | Microsoft Team Foundation Server | Debug.

SNAGHTMLfdb988a

One of the Information Debug Logs was showing the following error:

 

   1:  Log Name:      Microsoft-Team Foundation Server/Debug
   2:  Source:        Microsoft-Team Foundation Server
   3:  Date:          8/16/2013 10:09:10 AM
   4:  Event ID:      0
   5:  Task Category: This task has debugging events
   6:  Level:         Error
   7:  Keywords:      Info Messages
   8:  User:          DOMAIN\TFSSERVICE
   9:  Computer:      TFS.company.local
  10:  Description:
  11:  TFS Informational message
  12:  Event Xml:
  13:  <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  14:    <System>
  15:      <Provider Name="Microsoft-Team Foundation Server" 
  16:                Guid="{81761665-68A4-47D5-8106-F2ED2AA8687B}" />
  17:      <EventID>0</EventID>
  18:      <Version>0</Version>
  19:      <Level>2</Level>
  20:      <Task>1</Task>
  21:      <Opcode>10</Opcode>
  22:      <Keywords>0x8000000000000001</Keywords>
  23:      <TimeCreated SystemTime="2013-08-16T14:09:10.375773800Z" />
  24:      <EventRecordID>13163</EventRecordID>
  25:      <Correlation ActivityID="{018C9C58-F800-0003-99AD-5341209ACE01}" />
  26:      <Execution ProcessID="1472" ThreadID="4720" />
  27:      <Channel>Microsoft-Team Foundation Server/Debug</Channel>
  28:      <Computer>TFS.company.local</Computer>
  29:      <Security UserID="S-1-5-21-827956790-191126496-1124750213-8536" />
  30:    </System>
  31:    <UserData>
  32:      <Info TraceId="{00000001-0001-0001-0000-000000000000}  " 
  33:            xmlns="http://schemas.microsoft.com/TeamFoundation/2010/Framework">
  34:        <Tracepoint>1600</Tracepoint>
  35:        <ServiceHost>{00000000-0000-0000-0000-000000000000}</ServiceHost>
  36:        <ContextId>0</ContextId>
  37:        <ProcessName>TFSJobAgent</ProcessName>
  38:        <Username>
  39:        </Username>
  40:        <Service>
  41:        </Service>
  42:        <Method>
  43:        </Method>
  44:        <Area>JobAgent</Area>
  45:        <Layer>JobServiceUtil</Layer>
  46:        <UserAgent>
  47:        </UserAgent>
  48:        <Uri>
  49:        </Uri>
  50:        <Path>
  51:        </Path>
  52:        <UserDefined>
  53:        </UserDefined>
  54:        <Message>
  55:          Attempt #155: System.ArgumentException: An item with the same key 
  56:                                                  has already been added.
  57:          at System.Collections.Generic.Dictionary`2.Insert(TKey key, 
  58:                                                            TValue value, 
  59:                                                            Boolean add)
  60:          at Microsoft.TeamFoundation.Framework.Server
  61:              .TeamFoundationExtensionUtility.LoadExtensionTypeMap[T]
  62:                        (String pluginDirectory)
  63:          at Microsoft.TeamFoundation.Framework.Server.JobApplication
  64:              .SetupInternal()
  65:          at Microsoft.TeamFoundation.Framework.Server.JobServiceUtil
  66:              .RetryOperationsUntilSuccessful(RetryOperations operations, 
  67:                                              Int32 maxTries, 
  68:                                              Int32& delayOnExceptionSeconds)
  69:        </Message>
  70:      </Info>
  71:    </UserData>
  72:  </Event>

Notice on lines 37 & 55 – 56 we have the really important info.  The error is thrown by the TFSJobAgent and the problem is that it is trying to load an item with the same key into a Dictionary.

Solution

A quick online search turned up a blog post by Rory Street aptly entitled “TFSJobAgent Error – An item with the same key has already been added” in which he comments that the cause was that he had multiple copies of a custom warehouse adapter in the TFSJobAgent’s PlugIns folder. 

C:\Program Files\Microsoft Team Foundation Server 11.0\Application Tier\TFSJobAgent\plugins

When the TFSJobAgent service starts it recursively scans the Plugins folder looking for warehouse adapters (Microsoft’s or custom).  It uses reflection to find all of the assemblies that implement the ITeamFoundationJobExtension interface.  Since I have two copies of the same adapter (with different file names) in the folder, it tries to load them both and the names collide.  Rory had a slightly different configuration. He had copies of his custom warehouse adapter in a subfolder of PlugIns but the effect is the same sine the search is recursive

To clean up the multiple copies of my custom adapter in the PlugIns folder I needed to:

  • Start an elevated command prompt
  • Run: net stop TfsJobAgent
  • Delete the extra custom warehouse adapter DLLs from the Plugins folder (and its children)
  • Run: net start TFSJobAgent

Once that was done I rechecked the Warehouse Controller Web Service and all of my QueuedScheduled jobs were either Running or completed successfully.

Thanks Rory! :)

30 June 2013

How To: Reset a Microsoft Surface RT back to Windows 8.0 after installing Windows 8.1 Preview

This post is an elaboration on the Microsoft Support Article Remove Windows 8.1 Preview from Surface.  I felt that this post was needed because of some confusing, missing and incorrect entries in the Microsoft article.

Like many folks, I decided to update my Surface RT to Windows 8.1 Preview the day it came out. The Surface is a new animal, so I wanted the ability to roll back to Windows 8.0 if it became necessary. To be honest, I generally run all Beta and RC versions of Microsoft Operating Systems on my day-to-day devices (laptop, tablet and Windows Phone) and put up with the hiccups so I didn’t expect to need to rollback.   

The Preview documentation says that you can RECOVER your device (wipe it back to 8.0 losing all data) if you create a Recovery USB Drive. I followed these direction to create my USB drive. 

Really, Really Important Stuff

NOTE: If you don’t have a Recovery USB drive prior to upgrading to Windows 8.1 Preview, you cannot reset back to Windows 8.0.  The Surface on-device recovery partition gets updated to Windows 8.1 Preview along with the main partition. Only the USB drive lets you go back.

NOTE 2: If you didn’t create a Recovery USB drive for your Surface you may still be able to get one after the fact.  You will need to create a Recovery drive on a friend, family member or co-worker’s device. Since the Recovery is a “wipe and reset” then any recovery drive should work.  Disclaimer: I haven’t had to do this, but I believe that it will work. Please take this into account if you decide to go this route.  The worst case scenario is that you brick your Surface. You have been warned.

NOTE 3: If you have upgraded your Surface RT device to Windows 8.1 Preview, you will be able to roll-forward to Windows 8.1 Release Candidate or full release when it becomes available. This action will preserve all of your settings and apps, it is non-destructive.

Why I Rolled-back

I had problems with some of the apps that I use regularly so I decided to wipe my device back to Windows 8.0.

Some of my problems included:

  • Scrolling in Rowi’s tweet list stuttered
  • I had 6 Windows Store Updates that would fail to install. when I marked them to be skipped they reappeared as updates when I rebooted.
  • The Kindle app would no longer keep track of the farthest page read , but would return to page 1 when opening a book.
  • The Mail app would randomly stop connecting to my Office365 email account after adding the account to Outlook RT.

With that said, I will probably reinstall the 8.1 Preview once I hear that the scrolling issues are fixed. I can deal with the rest or work around them fairly easily.

What I Did

I performed searches all over Google, Bing and the Microsoft Support Forums looking for the steps to reset my Surface. I was unsuccessful until this evening when I came across a Microsoft Support Article (linked at top).

As I was going through the steps I noticed some discrepancies, so I figured I’d document my steps in case anyone else comes across this.  I’m copying in the steps from the Microsoft article and adding my own comments as sub-bullet points.

Reset Surface from a USB recovery drive

  1. Open the Settings charm, tap or click Power, and then tap or click Shut down. (Or, tap or click the Power icon in the lower-right corner of the sign-in screen.)
  2. Attach the USB recovery drive to Surface.
  3. Hold the volume-down (-) rocker.
  4. Press and release the power button.
  5. When the Surface logo appears, release the volume rocker.
  6. Choose your language options.
  7. Choose your keyboard layout.
  8. From the BitLocker screen, tap or click Skip This Drive.
    • The keyboard might appear so tap the non-text area of the screen to dismiss it so you can see the Skip This Drive link.
  9. Tap or click Troubleshoot.
  10. Tap or click Reset your PC.
  11. Tap or click Next.
    • This is actually a button that says “Windows 8.1 Preview”. This kinda threw me. Select this button, it will give you Windows 8.0. You will have to wait a bit for the next screen to appear.
  12. Surface Pro only: Tap or click No, keep the existing partitions.
    • I saw this on my Surface RT. I selected “No” like this says.
  13. Tap or click Just remove my files.
  14. When Surface displays All ready to go, tap or click Reset.
    • This message never displayed. After Step 13, it went ahead and started the restore.

Surface will reset back to factory settings.

 

If this is helpful, if I’ve messed any steps up or if you see something different, please leave a comment below.

Thanks

01 May 2013

Using the Nugetter CodePlex project with TFS 2012 build throws TF215097 error

Problem

While working with a client recently I came across an issue that I think needs to be better documented. 

We were implementing Nuget packaging in their TFS 2012 build process.  I knew from past engagements that the Nugetter project on CodePlex is an excellent way to easily add this activity to an existing build process.

We created the build definition using the NuGetterMultiPkgBuildVersionedTemplate20.xaml build process template. When we ran the build, it failed with the following error

TF215097: An error occurred while initializing a build for build definition
[Build Definition] nuget:

Exception Message: The invocation of the constructor on type
'TfsBuild.NuGetter.Activities.NuGetterProcess' that matches the specified
binding constraints threw an exception. (type XamlObjectWriterException)


Exception Stack Trace:
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance(XamlType xamlType,
Object[] args)
at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(
ObjectWriterContext ctx)
at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter,
Boolean closeWriter)
at System.Activities.XamlIntegration.FuncFactory`1.Evaluate()
at System.Activities.DynamicActivity.OnInternalCacheMetadata(
Boolean createEmptyBindings)
at System.Activities.Activity.InternalCacheMetadata(Boolean createEmptyBindings,
IList`1& validationErrors)
at System.Activities.ActivityUtilities.ProcessActivity(ChildActivity childActivity,
ChildActivity& nextActivity, Stack`1& activitiesRemaining,
ActivityCallStack parentChain, IList`1& validationErrors,
ProcessActivityTreeOptions options, ProcessActivityCallback callback)
at System.Activities.ActivityUtilities.ProcessActivityTreeCore(
ChildActivity currentActivity, ActivityCallStack parentChain,
ProcessActivityTreeOptions options, ProcessActivityCallback callback,
IList`1& validationErrors)
at System.Activities.ActivityUtilities.CacheRootMetadata(Activity activity,
LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options,
ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.Validation.ActivityValidationServices
.InternalActivityValidationServices.InternalValidate()
at Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers.ValidateWorkflow(
Activity activity, ValidationSettings validationSettings)
at Microsoft.TeamFoundation.Build.Hosting.BuildProcessCache.LoadFromXaml(
String workflowXaml, TextExpressionImports textExpressionImports)
at Microsoft.TeamFoundation.Build.Hosting.BuildControllerWorkflowManager
.PrepareRequestForBuild(WorkflowManagerActivity activity, IBuildDetail build,
WorkflowRequest request, IDictionary`2 dataContext)
at Microsoft.TeamFoundation.Build.Hosting.BuildWorkflowManager.TryStartWorkflow(
WorkflowRequest request, WorkflowManagerActivity activity,
BuildWorkflowInstance& workflowInstance, Exception& error, Boolean& syncLockTaken)

Inner Exception Details:

Exception Message: Exception has been thrown by the target of an invocation.
(type TargetInvocationException)

Exception Stack Trace:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments,
Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,
Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr,
Binder binder, Object[] parameters, CultureInfo culture)
at System.Activities.XamlIntegration.ActivityXamlServices.GetXamlSchemaContext(
Assembly assembly, String helperClassName)
at System.Activities.XamlIntegration.ActivityXamlServices.InitializeComponent(
Type componentType, Object componentInstance)
at TfsBuild.NuGetter.Activities.NuGetterProcess.BeforeInitializeComponent(
Boolean& isInitialized)
at TfsBuild.NuGetter.Activities.NuGetterProcess.InitializeComponent()

Inner Exception Details:

Exception Message: Could not load file or assembly 'System.Management.Automation,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
The system cannot find the file specified. (type FileNotFoundException)

Exception Stack Trace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,
String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint,
StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound,
Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,
Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark,
IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection,
Boolean suppressSecurityChecks)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at XamlStaticHelperNamespace._XamlStaticHelper.Load(String assemblyNameVal)
at XamlStaticHelperNamespace._XamlStaticHelper.LoadAssemblies()
at XamlStaticHelperNamespace._XamlStaticHelper.get_SchemaContext()

I’ve pasted the entire error message here so that it will be indexed by search engines and thus easier to find. :)

Solution

We did a little bit of searching online and followed a few dead-end trails.  We finally tracked down a discussion article on the Nugetter project’s discussion page that pointed to a mismatched PowerShell version on the build controller.

While our build controller machine was running Windows Server 2008 R2, we found that it only had PowerShell v1.0 installed.  We need to have PowerShell v3 installed for this to work.

We installed PowerShell v3 on the build controller and build agent and rebooted both machines.  When we triggered the build again it ran to completion.

I’m not sure if the updated PowerShell was necessary for the Build Agent machine but the client decided to install it anyway.

Synopsis

If you encounter this error, make sure the Build Controller box has PowerShell v3 installed on it.

30 March 2013

How To: Create an offline installer for Visual Studio from a Web Installer

Synopsis

If you have the need to download the complete set of files for a given Visual Studio update so that you can burn them to media or place them on an internal network share for distribution, you can run the Visual Studio 2012 installation bootstrapper with the /layout switch to force it to download all of the update packages and place them on your drive in a folder of your choosing.

   1:  "VS2012.2 CTP.exe" /layout
 

You can now use that installation folder’s contents as the source for your upgrades. Please realize that you will need a couple of GBs of space to save the installation.  The complete download for VS 2012.2 CTP 4 comes in at 1.66GB.


 tl;dr

Problem

The current VS Updates use a small installation “bootstrapper” that figures out what you have installed (Pro vs. Premium vs. Ultimate) and then does an install-time download of the needed updates. As you can see in Figure 1, the update installer is only 1.3MB in size so it downloads fast and your installation can begin immediately.  You will also notice that there is no option to download the entire update for all Visual Studio versions as a single MSI or ISO file.

SNAGHTML3ca3dd

Figure 1: Downloads page from Visual Studio 2012 Update 2 CTP 4 ds page - http://www.microsoft.com/en-us/download/details.aspx?id=36833 

When you run this installer you will see that the installation take a while to start.  It will eventually get to the “Install” screen.  There is a “More Information” link that changes the display to show you all of the packages that will be downloaded and installed for your particular installation.  As you can see in Figure 2, updating my Visual Studio 2012 Ultimate installation will cause the installer to download an additional 775MB of data during the install.  If I had Visual Studio Premium the download would be smaller and if I had Visual Studio Pro, it would be even smaller yet. So the architecture of a small bootstrapper that figures out and downloads only the needed updates is a good one to reduce overall bandwidth, especially in bandwidth constrained environments or countries.

But what if you have to do this to multiple machines?  You are now performing the same download over and over again.  The time-to-download tax is being paid by everyone on the team. Another scenarios is that you might be working in a highly-secure environment and your development machine doesn’t have access to the internet. In this case you absolutely have to get the update from an internet-connected machine and then place it somewhere it can be accessed by the secure PCs (or burn it to disk).

SNAGHTML4fe466

Figure 2: The additional downloads needed to update VS 2012 Ultimate Update 1 to VS 2012 Ultimate Update 2 CTP 4

 

Solution

To allow for this scenario, Microsoft has added a command-line switch option to the installation bootstrapper executable. You can use the /layout parameter to force the installer to download all of the update packages to specified folder.

SNAGHTML664b92

Figure 3: Command-line parameters for VS installs - http://msdn.microsoft.com/en-us/library/e2h7fzkw.aspx

When you run the installer with the /layout option, the installer will display a dialog that allows you to select the download location.

SNAGHTML6b9290

Figure 4: Using the /layout option to have the installer prompt for a download location

Clicking the Download button on the installer dialog will start the download.  As you can see in Figure 5, the download pulls all of the packages and stores them in a Packages folder under the folder you specified.  You can also see that it is complete download of all languages.  I am downloading from a machines whose locale is set to en-us but Figure 5 is showing that it is downloading the “Entity Framework Designer for Visual Studio 2012 – JPN”.

SNAGHTML709b95[4]

Figure 5: Downloading installation packages.

When it finishes you will se the “Setup Complete” message. 

Notice that in Figure 2, Visual Studio was telling me that it needed to download an additional 775MB of installation packages to update my machine.  In Figure 6 you can see that using the /layout option actually cause Visual Studio to download 1.66GB of packages. 

SNAGHTML82906e

Figure 6: Download complete. Requires 1.66GB for VS 2012.2 CTP 4

So regardless of whether the machine you are using has VS Ultimate, Premium, Pro or nothing at all, the /layout switch will pull down all of the packages that would be shipped as an .ISO or .MSI. That will allow you to do this process once and be able to update any Visual Studio installation across your company, even localized versions.

Summary

To create a stand-alone, offline installer for Visual Studio or it’s updates from a Web Installer, you can use the /layout command-line option.  This will download all of the installation packages that Microsoft provides for all versions and languages of Visual Studio. This download can then be burned to disk, copied to USB or copied to a network share for distribution.

Using the bootstrapper alone will significantly save on bandwidth since it will determine your VS version and language so that it only downloads those updated packages that you truly need for your installation.

Technorati Tags: ,,,,,,

06 March 2013

TFS 2012 Quick Note: How to add text formatting and line breaks to the DEFAULT text of a work item field

This is a quick note so that I can find this in the future. Smileimage

What:

There are times when you want modify a work item so that the value of an HTML string field, like the Description field on a Requirement, has some default value when a new work item is created. You may also want to put some formatting on some or all of this text.

I was working with a customer that wanted to have a “template” for data security that would help the Business Analysts be more consistent in their requirement documentation. We added some bold template text that would be used as a reminder.  The BA would just add the field name and security requirements in plain text next to the defaulted labels.

SNAGHTMLb8342

How:

To get this effect we set the DEFAULT rule on the underlying HTML field to a string of HTML that will get rendered at runtime.  There are two ways that you can enter the HTML to be rendered, through the Process Template Editor or directly within the work item type definition file.  Please note the caveat at the end of this article so you don’t get burned by a limitation of the work item definition schema.

Using the Process Template Editor

When using the Process Template Editor you need to create a DEFAULT rule for your field. In the FROM field select “value” and in the VALUE field you enter your HTML fragment.  In this editor you can enter your HTML just like you would in Visual Studio.  When you hit OK to close the DEFAULT dialog it will escape all of the special characters in the HTML fragment.

SNAGHTML1632e2

Editing the Work Item Type Definition directly

If you edit the work item type definition directly, you have to escape all of the “special” characters so that they don’t interfere with the raw XML surrounding them.  When uploaded to TFS, the escaped entries will be converted to HTML tags that can be rendered at runtime.

   1:  <FIELD name="Security" refname="MyCompany.Security" type="HTML">
   2:      <DEFAULT from="value" value="&lt;b&gt;Field Name:&amp;nbsp;&lt;/b&gt;&lt;br/&gt;&lt;b&gt;Security:&amp;nbsp;&lt;/b&gt;&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Field Name:&amp;nbsp;&lt;/b&gt;&lt;br/&gt;&lt;b&gt;Security:&amp;nbsp;&lt;/b&gt;" />
   3:  </FIELD>

Caveat

There is one thing that really limits the usefulness of this technique.  There is a limit of 255 characters in the value attribute of the DEFAULT element.  This limit is imposed when you import the work item type definition into the team project, so you have to be aware of this when using the Process Template Editor as the text entered there will be escaped on save and could easily go over the character limit.

22 January 2013

Community TFS Report Extensions open-source reports hits v1.0 milestone

Microsoft ALM MVP Tommy Norman and I have been working on creating a set of reports that fill some of the gaps in the TFS 2010 out-of-box process templates.  The output of this effort is the Community TFS Report Extensions project on Codeplex which was started this past summer but has finally become stable enough to reach the v1.0.0 milestone.

Tommy has crafted a nice write-up on his blog, so please pop over there and take a look then head on over to the project and check out the first two reports.

 

TestPlanStatusReport

Figure 1 - Test Plan Status report

 

SNAGHTML90acb5

Figure 2 – Release Plan report

23 December 2012

VS 2012 - Coded UI Tests (CUIT) Now Automatically Closes Browser or App Upon Test Completion

VS2012Logo

Synopsis

  • Microsoft changed the behavior of Coded UI Tests between Visual Studio 2010 and Visual Studio 2012.
  • The change is that the browser window or app window being used for the test case will automatically be closed after each test case unless you add code to keep it open.
  • In any event, the browser window or app window used will always be closed at the end of a test run.
  • During development you can use a Breakpoint to halt test execution prior to the windows being closed.

Issue

There is a behavior change between Coded UI Tests (CUIT) running in Visual Studio 2010 and Visual Studio 2012 .  In Visual Studio 2010, a test case would leave windows open on the desktop unless they were explicitly closed in code in the test class.  In Visual Studio 2012 , the window of the application under test (browser, WPF app, etc.) is automatically closed whether or not it was closed in code during the test run.  If you are new to CUIT and you only use VS 2012 then you weren’t aware that the behavior changed.  If you have upgraded from VS 2010 then this is something new.

Why did the folks at Microsoft make this change?

This change was added to make it easier to create an maintain test cases because it saves you from explicitly having to close your app window or browser at the end of every test. An automated test run that has many test cases launching browser windows but never closing them will leave the test client’s desktop in a messy state.  I agree that it makes CUIT easier.

So why write a blog post about something you agree with?

The reason for this post is that it changes the way that folks from VS 2010 interact with coded UI tests, specifically if you use a manual test’s Action Recording as the starting point for your CUIT. 
In VS 2010 I would create a new CUIT and use the action script from a manual test case to generate a base test without any validation as in the code below. I’d then run this test to make sure everything worked as expected.  At the end the browser would close.
   1:  [TestMethod]
   2:          public void KioskSmokeTest()
   3:          {
   4:              // To generate code for this test, select "Generate Code for Coded...
   5:              // For more information on generated code, see http://go.microsoft...
   6:              
   7:              this.UIMap.StartDinnerNowKiosk();
   8:              this.UIMap.ExerciseUI();
   9:              this.UIMap.CloseKiosk();
  10:          }
Figure 1: Basic coded UI test that explicitly closes the app under test

Now I need to add some validation to my test.  Normally I would just comment out the line that closes the windows, in my example this.UIMap.CloseKiosk() and re-run the test.  This would leave the app window open and the app would be in the correct state for me to add validations. 
   1:  [TestMethod]
   2:          public void KioskSmokeTest()
   3:          {
   4:              // To generate code for this test, select "Generate Code for Coded...
   5:              // For more information on generated code, see http://go.microsoft...
   6:              
   7:              this.UIMap.StartDinnerNowKiosk();
   8:              this.UIMap.ExerciseUI();
   9:              //this.UIMap.CloseKiosk();
  10:          }
Figure 2: Basic coded UI test that is supposed to leave the app window open at the end
My example is fairly simple, but what if the ExerciseUI() method actually navigated through 4 or 5 screens and added test data. In this case, my process has allowed the test to perform all of the data entry and I am assured that the app is in the correct state for my validations.  This saved me a lot of work and headaches.
In VS 2012, this behavior isn’t the same.  The CloseKiosk() method is no longer needed as the test engine will automatically close the app between test cases unless told to keep them open.  In effect, the first code example is now equivalent to the second one.

But I liked the old behavior, is there a workaround?

Your only option is to set a breakpoint on the last executable line within your test case and then go to Test View and right-click on the test’s name then select Debug Selected Tests.  When the breakpoint gets hit, press F10 to let the last executable line run then just stop debugging.  That will leave your app in the correct state and you can now use the Coded UI Test Builder to create your Assertions.
SNAGHTML1fe8b15b
Figure 3: Use a breakpoint and debug your test to get to the right app state for validation
SNAGHTML1fe63578
Figure 4: Stop debugging when you have finished execution of all of the preparatory steps

What if I chain test cases together and assume that the app stays open between tests?
Some folks write completely self-contained tests like my KioskSmokeTest above.  Other folks have more complex needs and write tests that get run in a specific order, each collaborating to setup the state of a system and then performing validations. This can be called “chaining tests”.
If you have chained tests, the new behavior will break your test runs since the application under test gets closed after each test case is run.  Microsoft has added some new flags that can be set (depending on app platform) to tell the test engine to leave your app alone between tests cases in a single test run.
If your target app is browser-based, you can tell the testing framework to leave the browser open at the end of the test case by setting the BrowserWindow.CloseOnPlaybackCleanup property to false (Line 5 below).
   1:          [TestMethod]
   2:          public void VerifyValidDefaultSearchTest()
   3:          {           
   4:              //Leave the browser open            
   5:              this.UIMap.UIDinnerNownetWindowsIWindow.CloseOnPlaybackCleanup = false;
   6:   
   7:              this.UIMap.StartvalidsearchParams.UIDinnerNownetWindowsIWindowUrl                                                = "http://WebTest/DinnerNow/Default.aspx";   
   8:              this.UIMap.Startvalidsearch();
   9:              this.UIMap.ClicktheFindbutton();
  10:          }
Figure 5: Use CloseOnPlaybackCleanup to keep the browser open


The Microsoft Visual Studio ALM team has a nice blog post describing this in more detail.

If your target app is not browser-based (WPF/WinForms/etc.) then you need to use the ApplicationUnderTest.CloseOnPlaybackCleanup() property.


Note: There is a bug in VS 2012 RTM that causes ApplicationUnderTest.CloseOnPlaybackCleanup() property to be ignored.  This bug is fixed in VS 2012 Update 1.


Unfortunately the ApplicationUnderTest object isn’t as easy to access as the BrowserWindow objects.  To make this work you will have to capture the instantiation of your app in the UIMap.Designer.cs file and store the reference in a variable that can be seen from your test methods.
Below you see the code that was generated in the UIMap for my application.  This code launches the DinnerNowKiosk application and uses a local variable to store the handle to the app.  Once the StartDinnerNowKiosk method goes out of scope, the reference is no longer accessible.  Also, you can’t just go and add a call to dinnerNowKioskApplication.CloseOnPlaybackCleanup = false because this is a generated code file so the added code will be lost of the UIMap is regenerated.

   1:          public void StartDinnerNowKiosk()
   2:          {
   3:              ApplicationUnderTest dinnerNowKioskApplication = ApplicationUnderTest.Launch
                                                                     (this.StartDinnerNowKioskParams.ExePath,
                                                                      this.StartDinnerNowKioskParams.AlternateExePath);
   4:          }

Figure 6: The generated application launch code in the UIMap.designer.cs file
Instead you have to use the UIMap.cs partial class to add your new startup code.  Just copy the StartDinnerNowKiosk() method into the partial class and set the CloseOnPlaybackCleanup property to false.
   1:      public partial class UIMap
   2:      {
   3:          static ApplicationUnderTest dinnerNowKioskApplication_persistent = null;
   4:   
   5:          public void StartDinnerNowKiosk_Persistent()
   6:          {
   7:              if (null == dinnerNowKioskApplication_persistent)
   8:              {
   9:                  dinnerNowKioskApplication_persistent = ApplicationUnderTest.Launch                                                                      (this.StartDinnerNowKioskParams.ExePath,                                                                       this.StartDinnerNowKioskParams.AlternateExePath);
  10:                  dinnerNowKioskApplication_persistent.CloseOnPlaybackCleanup = false;
  11:              }
  12:          }
  13:   
  14:      }

Figure 7: The new app launch code from the non-generated partial class in the UIMap
And then change your test to call the new app launcher method.
   1:      [CodedUITest]
   2:      public class KioskSmoke
   3:      {
   4:    
   5:          [TestMethod]
   6:          public void KioskSmokeTest()
   7:          {
   8:              this.UIMap.StartDinnerNowKiosk_Persistent();
   9:              this.UIMap.ExerciseUI();
  10:          }
  11:   
  12:          [TestMethod]
  13:          public void KioskSmokeTest2()
  14:          {
  15:              this.UIMap.StartDinnerNowKiosk_Persistent();
  16:              this.UIMap.AdditionalSteps();
  17:          }
  18:      }

Figure 8: The updated tests that call to the new app launcher.
In the example above, the StartDinnerNow_Persistent() method is called from each test case because we don’t know the order these test will be run. If you need to have the tests run in a specific order then you need to create an additional test method that calls them in the order desired.

Can I keep the app under test open between test runs?

No.  The app/browser is launched by the test agent process (QTAgent).  At the end of a test run QTAgent is shut down, so any child processes are also shut down. I have confirmed this behavior in VS 2012 RTM and VS 2012 Update 1.

Resources

MSDN: BrowserWindow class - http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.uitesting.browserwindow.aspx
MSDN: ApplicationUnderTest class - http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.uitesting.applicationundertest.aspx
MSDN:
Visual Studio 2012 Update 1 Download - http://www.microsoft.com/en-us/download/details.aspx?id=35774
Visual Studio 2012 ALM Blog: Coded UI Test: Why does application close after each test in Visual Studio 2012? - http://blogs.msdn.com/b/visualstudioalm/archive/2012/11/08/using-same-applicationundertest-browserwindow-across-multiple-tests.aspx

11 June 2012

Team Foundation Service is open to the public (and free!)

SNAGHTML80a046dThe Visual Studio Team has hit another major milestone in the evolution of Team Foundation Server.  Back at the BUILD conference last year they announce a hosted TFS offering called Team Foundation Service.  This hosted solution brings TFS based Work Item Tracking, Version Control and Automated Build through a browser and is connectable from Visual Studio just like an on-premises deployment of Team Foundation Server.  Use of the service was limited to those few that were able to get their hands on an Invitation Code.  This was done primarily to allow for a slow ramp-up in users of the service to help find and remedy scalability problems.

“Since we announced the Team Foundation Service Preview at the BUILD conference last year, we’ve limited the onboarding of new customers by requiring invitation codes to create accounts.  The main reason for this has been to control the growth of the service to make sure it didn’t run away from us and end up with a bad user experience.  In this time period, we’ve continued to work on our infrastructure, performance, scale, monitoring, management and, of course, some cool new features like cloud build. ”   - Brian Harry

Today, Brian Harry announced that there is no longer the need for an Invitation Code.  The Service is now open to the Public.  This means that they are confident in the service’s ability to handle the load as well as their ability to monitor activity and upgrade the service with little disruption to the global user community.

They are still offering the service without charge and while they get the final pieces in place to offer a complete commercial service.

“The service will remain in “preview” for a while longer while we work through additional features like data portability, commercial terms, etc but the terms of service support production use, the service is reliable and we expect to carry all of your data forward into production. ”  - Brian Harry

Brian has an excellent walk-through on how to get access to the service and begin playing with the service, the cloud-hosted build servers and the new Azure continuous deployment features.

Brian’s complete post can be found at http://blogs.msdn.com/b/bharry/archive/2012/06/11/team-foundation-service-preview-is-public.aspx