September 2011 - Posts

Tempted by the new Kindle?
Wed, Sep 28 2011 10:32

I am back on the should I buy a Kindle train of thought. Todays announcements are certainly interesting, I am not talking so much about the new Kindle Fire, but the new entry level version and the Touch. For me the tempting feature is still the E-Ink and battery life.

The point is I have got used to reading on my phone, a Kindle might be easier on the eye, but it is more kit to carry, and I just don’t think I want to carry any more things.

Just posted VirtualPC activity documentation for TFS 2010 Community Build Extensions
Tue, Sep 27 2011 9:18

I have just posted new VirtualPC activity documentation for TFS 2010 Community Build Extensions. This has been a really nasty set of documentation to write as getting this activity running raises a lot of issues over COM security; thanks to Rik and Andy (our SharePoint specialists at Black Marble who are therefore used to COM problems!) who helped get to the bottom the issues.

The best think I can say about this VirtualPC activity (and I wrote much of it) is don’t use it. Much better to use the Hyper-V one it is far more flexible, allowing control of remotely hosted VMS, or even better use TFS Lab Management

Upcoming Black Marble event on Windows 8
Tue, Sep 27 2011 5:09

In case you did not make it to the Microsoft Build Conference, Black Marble are running a pair of free events in Leeds on the 12th of October on Windows 8 and the other announcements made in Anaheim earlier this month.

The morning session is focused on the IT pro side and the afternoon on development, so why not make a day of it?

To get more information, and to register for these free events, have a look at http://www.blackmarble.co.uk/Events

Syncing the build number and assembly version numbers in a TFS build when using the TFSVersion activity
Mon, Sep 26 2011 13:42

I was asked recently if it was possible to make the TFS build number the same format as the assembly build number when you are using the TFSVersion community extension. The answer is yes and no; the issue is that the build drop location in the standard build process template is create before any files are got into the workspace from source control. So at this point you don’t have new version number, a bit of a problem.

A detailed description of one approach to this general problem can be found in Ewald Hofman’s blog on the subject, but to use this technique you end up creating another custom activity to update the build number using your own macro expansion. Also there will be some major workflow changes to make sure directories are created with the correct names.

I was looking for a simpler (lazier) solution when using the TFSVersion activity and the one I came up with to just update the build name, and do it after the drop directory was created. So that I did not end up with two completely different names for the drop folder and build I just append the version number to the existing build number. This is done by re-running the Update Build Number activity. I added this new activity to example workflow logic from the TFSVersion documentation, ending up with something like

image

where the Update Build Number has the following properties

image

So we just append the newly generated version number to the existing build number.

string.Format("{0} ({1})", BuildDetail.BuildNumber , VersionNumber)

Note you can’t use the BuildNumberFormat.in this string format as this string contains the $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r) text that via macro expansion is used to generate the build number. The problems if this expansion if used in this string format you get the error

The revision number $(Rev:.r) is allowed to occur only at the end of the format string.

So it is easier to use the previously generated build number.

This also has the effect that drop folder retains the original name but all the reports contain the old folder name with the generated build number in brackets, and the Open Drop Folder link still works

image

I reasonable compromise I think, not too much change from a standard template.

by But it works on my PC!
Filed under: ,
Video of my Webinar for Typemock is available
Mon, Sep 26 2011 4:26

The video of my recent webinar for Typemock on using Isolator for designing SharePoint webparts is up at http://www.typemock.com/sharepoint-web-parts

You can also find a link to it from http://bit.ly/RFennellVideos, as well as links to all the other videos of my presentations I know of that are publically available.

More documentation for the TFS 2010 community build extensions
Sat, Sep 24 2011 14:03

Today I have posted a few more pages of the getting started documentation for the TFS 2010 community build extensions. This is an on-going task, I hope to get a few more written when I get a chance. I am writing the documentation in no obvious order, so let me know if any specific activity is in more need of some introductory level documentation than others.

by But it works on my PC!
Filed under: ,
New Release of the Community TFS 2010 Build Extensions
Fri, Sep 23 2011 2:42

Mike Fourie has just announced that we’ve just shipped the second stable release of the Community TFS 2010 Build Extensions. Well worth a look if you need to customised your TFS 2010 build with any of the following

  • AssemblyInfo
  • BuildReport
  • BuildWorkspace
  • CodeMetric
  • DateAndTime
  • Email
  • File
  • GetBuildController
  • GetBuildDefinition
  • GetBuildServer
  • GetWebAccessUrl
  • Guid
  • Hello
  • HyperV
    • IIS7
    • ILMerge
    • InvokePowerShellCommand
    • nUnit
    • QueueBuild
    • RoboCop
    • SqlExecute
    • StyleCop
    • TFSVersion
    • VB6
    • VirtualPC
    • VSDevEnv
    • Wmi
    • WorkItemTracking
    • Zip
    Stupid gotchas on a SQL 2008 Reporting Services are why I cannot see the Report Builder Button
    Wed, Sep 21 2011 7:17

    There is a good chance if you are using TFS that you will want to create some custom reports. You can write these in Reporting Services via BI Studio or Excel, but I wanted to use Report Builder, but could not see the Report Builder button on this Reporting Services menu

    image

    The problem was multi-levelled

    First I had to give the user access to the Report Builder. This is done using folder property security. I chose to give this right to a user (along with browser rights) from the root of the reporting services site

    image

    But still no button. Forums and blog posts then talk about changing options on the ‘Site Settings’ menu, the above screenshots shows that this is also missing from the top right.

    To get this menu option back, I had to run my browser as administrator and then this option appeared. Turns out that the TFS Setup user I was using  had not been made a Reporting Services site administrator, just a content administrator.

    But still this was not enough, I also add to add users as System Users to allow the Reporting Services button to appears. So my final Site Settings > Security options were

    image

    Once all this was done I got my Report Build button and I could start to write reports.

    Another ALM/TFS focused blogger at Black Marble
    Mon, Sep 19 2011 3:36

    Robert Hancock, another one of Black Marble’s ALM consultants, has started blog technical tips on this blog server. You can find Robert’s new blog here or the aggregate feed of all Black marble bloggers here

    by But it works on my PC!
    Filed under: ,
    What to do when your TFS build agent says it is ready, but the icon says it is not
    Sat, Sep 17 2011 15:10

    When using TFS2010 It is possible for a build agent to appear to be ready (or so the status label says) but the icon stays in the off state.

    image

    This is usually due to a couple of broad categories of error, you can find out which by checking the Windows event log.

    The build agent cannot communicate with the controller

    In the event log you see something like

    Service 'Default Agent - win7' had an exception:
    Exception Message: There was no endpoint listening at
    http://controller.mydomain.co.uk:9191/Build/v3.0/Services/Controller/1 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. (type EndpointNotFoundException)

    This should not happen too much within a corporate LAN, though it is always worth checking to make sure any PCs firewalls are not blocking the port used by the build service (9191).

    However if you are trying to use build agents that are not directly on your LAN/AD (see this lovely clear blog post on how to set up using a non-domain joined build agent) there is a good chance you will not have DNS working as expected. So make sure the controller can resolve the name of the agent and vice versa. For me this meant editing HOST files and checking name resolved with good old PING.

    Custom assemblies have un-resolved dependencies

    Whilst writing documentation for the community extensions for TFS build I had the this problem. I had the custom assemblies path set for the build controller. This meant when the build agent starts it downloads any custom assemblies from the specified folder. Some the community extensions assume that the build agent has features/application installed such IIS or Visual Studio. I had assumed any missing dependencies would only show up when you tried to use a community activity in a build. However, this is not the case it seems. During the agent load some checks are made. In the event log I saw errors such as

    Service 'Default Agent - win7' had an exception:
    Exception Message: Problem with loading custom assemblies: Could not load file or assembly 'Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. (type Exception)

    or

    Service 'Default Agent - win7' had an exception:
    Exception Message: Problem with loading custom assemblies: Could not load file or assembly 'Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. (type Exception)

    To resolve these issues I installed the features and application on the agent needed by the build extensions. The other option would be remove the custom extension assemblies that had the dependencies, assuming you did not need them.

     

    So hopefully this post shoudl give you a pointer on fixing strange ‘has it started or not’ states that the build agent can get into

    TFS on Windows Azure preview announced at Build
    Wed, Sep 14 2011 15:59

    At the Build  conference today the preview of TFS on Windows Azure was announced. All the attendees of the conference have been given access codes for the preview. If you did not make it to Build have a look at  Brian Harry’s blog for details of how everyone else can get access to the preview.

    by But it works on my PC!
    Filed under: ,
    Bitlocker keeps asking for my recovery key after a change in my disk’s MBR
    Wed, Sep 14 2011 12:40

    My development laptop is bitlocker’ed, and yours should be too. It provides a great and non-invasive way (assuming you have a TPM chip) to protect you and your clients data on a machine that is far to easy to steal or loose. However, whilst fiddling with Windows 8 I did trip myself up.

    I have my PC setup for a boot to Windows 7 from a bitlocker’ed drive C with a non bitlocker’d drive D used to boot to Windows 2008 for demos (and hence no production data). To try out Windows 8 I added a new boot device, a boot from VHD partition. This edited the PC’s master boot record (MBR) and bitlocker did not like it. It thought the PC had a root kit or something similar to prompted me to enter a my bitlocker recovery key (which is 48 characters long) when I tried to boot to Windows 7. However, once this is done my bitlocker’ed Windows 7 partition worked find, but on each reboot I had to type the key in, bit of  pain. Removing the new VHD boot entry did not help, the MBR has still be edited, so bitlocker complained

    The solution was actually easy, but took me a while to find as it does not seem to be clear in any documentation or via a search.

    When the WIndows7 partition is booted open the control panel, select the bitlocker option and then suspend bitlocker, then restart it

    image

    This has the effect of telling the bitlocker system that you are accepting the current hardware/MBR setting are correct. After this the PC boots as expected

    If I were being more sensible I would suspend bitlocker prior to any fiddling about with Windows 8 – but the bits from Build was just too tempting……….

    First try with Windows8 and it won’t boot
    Wed, Sep 14 2011 12:16

    I tried to install Windows 8 Developer Preview on my Lenovo W520 laptop as a VHD boot. All seemed to go well following the same process as for windows 7. I got a nice new blue Window 8 boot partition choice screen (which went back to the Windows 7 DOS like one after I made Windows 7 my default partition).

    If I selected Windows 8 it tried to but but ended up with the error

    ‘Windows could not complete the installation. To install windows on this computer restart the installation’

    No more info than that, I suspect it does not like VHD boot. But I don’t have time to dig now, more later I am sure……

    Why can’t I see my custom work item types in Team Explorer?
    Wed, Sep 14 2011 8:40

    If you are editing a TFS process template you have the choice editing XML files or using the Process Template Editor within the TFS 2010 PowerTools. Unfortunately neither is fool proof. You can make errors than means the revised template does not fully work.

    The worst of these errors will be picked up when upload the process template to a Team project Collection as during this process the XML is validated.

    However, this will not find everything. Today after uploading a new process template I found I could not see two of my revised work item type in the list when I tried to create a new work item.

    The best way I found to work out the problem was to try to import the .WIT file (from your local copy of the process template) again using either the Visual Studio –> Tools –> Process Editor –> Work item Types –> Import from File, or the command line tool WITIMPORT

    In my case I then got the far more useful error

    --------------------------
    Error
    ---------------------------
    Error importing work item type definition:

    TF237094: Field name 'Priority' is used by the field 'Microsoft.VSTS.Common.Priority', so it cannot be used by the field 'MyNewProcess.Priority'.
    ---------------------------
    OK  
    ---------------------------

    This gave me much more information to fix my problem

    Bradford the centre of all scientific advance (at least this week)
    Tue, Sep 13 2011 5:23

    Over the weekend I took my son to the excellent ‘Bang goes the Theory’ Live road show which is part of the Festival of Science in Bradford. If a similar event is near you I recommend you go along, fun for all the family even if science is not really your thing. The whole event makes the subject very accessible to all.

    image 

    Even if I had not known this was on I might have guessed something as afoot in Bradford as virtually every Radio 4 news program has had a short article on some new scientific advance from Bradford University. Today a lie detector using facial analysis and a new cancer treatment to name just the ones I remember. Now I went to Bradford and I know it is world leader in biomedical science, but I do wonder if they have been saving press released to get the biggest bang. Or is it the BBC and other media outlets are in Bradford at the festival so it is easy to get Bradford stories?

    It is great to see more positive news articles on science and technology, but the danger is it is just a headline. We need to look behind the headlines to be better informed. Events like this road show a great step to get people interested to find out more, and always to keep ‘asking why is that……’

    ‘Expected to find an element’ error when running VS2010 Database unit tests
    Mon, Sep 12 2011 17:31

    If you use the database unit testing feature of VS2010 there is a good chance you will want to run these tests on more than one PC and probably the build server. The issue is that these different PC will need different deployment paths and SQL connection strings. Luckily there is a feature to address this, as detailed on MSDN. Basically the test runner swaps in a different config file based on either the PC name or user running the tests.

    This all seems straight forward, but when I followed the process and ran my tests they failed

    image 

    The most useful error is found if you get the test run details (the button highlighted in green). You can see that it found the file replacement config file but failed to parse it giving the error

    An error occurred while reading file C:\…\TestResults\fred_PCNAME 2011-09-12 22_33_11\Out\buildbox.dbunittest.config : Expected to find an element.

    [It is work noting here it is easy to forget to make sure the buildbox.dbunittest.config is deployed to the test folder as detailed on MSDN. If you forget this you get a file not found error not an ‘expected to find an element’ error]

    So I checked my buildbox.dbunittest.config file to look for typos. The MSDN instructions say to copy the app.config and make your edits, but then goes onto mention after editing it should resemble.

    <DatabaseUnitTesting> 
           <DatabaseDeployment DatabaseProjectFileName="..\..\..\Sources\UnitTest\UnitTest\UnitTest.dbproj" Configuration="Debug" />
           <DataGeneration ClearDatabase="true" />
           <ExecutionContext Provider="System.Data.SqlClient" ConnectionString="Data Source=.\SQLEXPRESS;
                           Initial Catalog=UnitTestB;Integrated Security=True;Pooling=False" CommandTimeout="30" />
           <PrivilegedContext Provider="System.Data.SqlClient" ConnectionString="Data Source=.\SQLEXPRESS;
                           Initial Catalog=UnitTestB;Integrated Security=True;Pooling=False" CommandTimeout="30" />
    </DatabaseUnitTesting> 

    It should NOT include the <?xml version="1.0" encoding="utf-8" ?>, <configuration> or <configSections> tags. This as been stressed in some forum posts. However even when I made sure my buildbox.dbunittest.config first line was <DatabaseUnitTesting> I still got the same error.

    Turns out the issue was that I had leading white space before the <DatabaseUnitTesting>, once this was done the test ran as expected.

    Registration has opened for Black Marble’s Autumn Events 2011
    Wed, Sep 7 2011 9:04

    If you look on the Black Marble web site you will find listing of the free events we are running up to the end of the year and into the new year. This year our events include

    12 Oct 2011 Re-Build – IT
    Re-Build – Dev
    Black Marble will bring you the key announcements and developments from Microsoft Build about Windows 8
    17 Nov 2011 Delivering High Impact WebSites with SharePoint

    SharePoint 2010 creates a dynamic and striking internet experience for your users.

    17 Nov 2011 A Guide to Successfully Adopting the Cloud for IT Managers This session will be exploring the business value of cloud computing with Microsoft Windows Azure
    8 Dec 2011 Architecture Forum in the North 4 The top Microsoft Architecture Forum in the UK returns for its fourth year.
    26 Jan 2012 Black Marbles Annual Technical Update for Microsoft Technologies - 2012

    Return of our roadmap for all things Microsoft!

    26 Jan 2012 Implementing the Secure Development Lifecycle in your ALM Process This session will look at how implementing Microsoft's Security Development Lifecycle (SDL) into your development process can improve quality, reliability and long-term maintainability

    All these events are free, but they can fill up so book early.

    .

    by But it works on my PC!
    Filed under:
    Update on using Typemock Isolator to allow webpart development without a Sharepoint server
    Tue, Sep 6 2011 16:56

    I have in the past posted about developing SharePoint web parts without having to use a SharePoint server by using Typemock Isolator. This technique relies on using Cassini or IIS Express as the web server to host the aspx page that in turn contains the webpart. This is all well and good for SharePoint 2007, but we get a problem with SharePoint 2010 which seems to be due to 32/64bit issues.

    Working with SharePoint 2007 assemblies when SharePoint 2010 assemblies are in the GAC 

    I started this adventure with a SharePoint 2007 webpart solution setup as discussed in my previous post. In this solution’s web test harness I was only referencing the SharePoint 2007 Microsoft.Sharepoint.dll. This had been working fine on a PC that had never had SharePoint installed, the required DLL was loaded from a local solution folder of SharePoint assemblies.

    This was until I installed SharePoint 2010 onto my Windows 7 development PC (a great way to do SharePoint development). This put the SharePoint 2010 assemblies into the GAC. So now when I ran my Sharepoint 2007 test harness I got the error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
    Compiler Error Message: CS1705: Assembly 'Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' uses 'Microsoft.SharePoint.Library, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' which has a higher version than referenced assembly 'Microsoft.SharePoint.Library, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'

    The solution is fairly simple, assuming you want work with the 2007 assemblies. All you need to do is make sure the test harness project also references the 2007 Microsoft.Sharepoint.library.dll so it does not pickup version in the GAC.

    image

    Once this is done the 2007 based test harness worked again

    But what about using 2010 assemblies?

    If you want to work against SharePoint 2010 assemblies there are other problems. If you just reference the 2010 Microsoft.sharepoint.dll you get the error

    Could not load file or assembly 'Microsoft.Sharepoint.Sandbox' or one of its dependencies. An attempt was made to load a program with an incorrect format

    As I said, on my PC I now have a SharePoint local installation, so I have the SharePoint 2010 assemblies in the GAC. It is from here the test harness tries to load the Microsoft.Sharepoint.Sandbox.dll assembly. The problem is that this is not a standard MSIL assembly but a 64bit one. The default Cassini development web server is 32bit. Hence the incorrect format error, the WOW64 technology behind the scenes cannot manage the loading. The only option is to use a 64bit web server to address the problem; so this rules out Cassini and IIS Express at this time as these are 32bit only.

    A possible solution is to use the full IIS 7.5 installation available with Windows7, as this must be 64bit as it is able to run SharePoint 2010. The problem here is that when you load the test harness you get the error

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: TypeMock.TypeMockException:
    *** Typemock Isolator is not currently enabled.
    To enable do one of the following:
    * To run Typemock Isolator as part of an automated process you can:
    - run tests via TMockRunner.exe command line tool
    - use 'TypeMockStart' tasks for MSBuild or NAnt
    * To work with Typemock Isolator inside Visual Studio.NET:
    set Tools->Enable Typemock Isolator from within Visual Studio
    For more information consult the documentation (see 'Running' topic)

    This is because this IIS instance is not under the control of Visual Studio and so it cannot start Isolator for you. To get round this you have to start Isolator manually, maybe you could do it in your test harness pages. However, you also have to remember that you if you want to debug against this IIS instance you must run Visual Studio as administrator – OK this will work, but I don’t like any of this. I really do try not to run as administrator these days.

    So what we need is a 64bit web server. The best option appears to be http://cassinidev.codeplex.com. This can be used as a direct replacement for Cassini. This is still a 32bit build by default, but if you pull the source down you can change this. You need to change all the projects from x86 to Any CPU, rebuild and copy the resultant EXE and DLLs over the Cassini installation. I recommend you copy the 32bit release build over first to get the right .config files in place. You probably don’t want to use the ones from the source code zip.

    Once this is all done you have a web server that can load 32bit and 64bits without issue. So for my test project I referenced the SharePoint 2010 assemblies (I maybe could have referenced less, but this works)

    image

    So we have a workaround, once setup it is used automatically. It is just a shame that the default web servers are all set to be x86 as opposed to Any CPU.

    Doing a webinar on using Typemock Isolator with SharePoint Webparts
    Mon, Sep 5 2011 8:50

    I am doing a free webinar on Wednesday, September 21, 2011 at 3:00 PM BST with the title "Using Typemock Isolator to speed the development of SharePoint Web Parts".

    For more details have a look at http://www.typemock.com/webinars the details should be up soon

    #DDDNorth registration has opened
    Mon, Sep 5 2011 7:14

    The agenda is up for DDDNorth, seems .JS related subjects are the fashionable topics for this conference. As I suspected my session on build customisation did not make the cut, just not cool enough!

    As with all DDD events the event is free, but the place tend to go quickly. I think this DDD has 300 spaces so I suggest you register quickly to avoid disappointment

    More Posts Next page »