TFS2010 VSSConverter woes

October 24th, 2009

Yesterday I’ve been busy installing the Beta 2 of Team Foundation Server 2010 to do some testing and to see if we can switch (yay go-live!). And in fact the installing went pretty smooth so the work Microsoft has been doing is really great.

Unfortunately when I decided it was time to move our Visual Source Safe database to TFS all went sour. The analysis of the VSS database with the VSSConverter tool worked but when I tried to migrate it just sat there and told me:

TF60070: Unable to connect to the Team Foundation Server: ‘http://ts01:8080/’. Please ensure that the Team Foundation Server exists and try again.

At first it seemed logical as the TFS is at http://ts01:8080/tfs so no worries there, just a bad config. Unfortunately there is no option in the configuration file to specify a full URL so basically I’m stuck. (small update: I tried to be clever and use URL redirection but it doesn’t work)

I’ve filed a bug on the Microsoft Connect site so if you’re having the same problem please vote for it so they’ll start to fix it.

Update 1: It seems that in Beta 1 the VSSConverter tool is unsupported. See the blog post from granth here, about half-way on the page

Update 2: Someone has been successful but with the VS2008 version of VSSConverter Nope, he was not.

Update 3: Matthew Mitrick (from Microsoft) has a good answer to this. You can read about it here.

The answer is that in the TFS 2010 Beta 2 there is a new feature called Collections. Unfortunately the documentation of VSSConverter has not been updated as there is a new configuration option to specify in which collection the projects should be migrated. So the solution is to add the option “collection” to the TeamFoundationServer element in the options.xml so it looks something like this:

<TeamFoundationServer name="myserver" port="8080" protocol="http"
collection="tfs/DefaultCollection"></TeamFoundationServer>

If you’ve installed TFS in another virtual directory than tfs you should modify the collection option accordingly. (Goes for the collection as well ;-) )

.Net , , ,

Binding a WPF DataGridColumn to a LINQ result

August 26th, 2009

I’ve been tinkering with Visual Studio 2010 Beta1 and the .Net 4 framework. One of the things that I’ve tried is filling a DataGrid with the results of a LINQ query.
Consider the following code:
C#

var voyages = from voyage in entities.Voyage
              select new { Number = voyage.Number, ETA = voyage.StartTime };

dataGridTest.ItemsSource = voyages;

XAML

<DataGrid Name="dataGridTest">
    <DataGrid.Columns>
        <DataGridTextColumn Header="Number" Binding="{Binding Path=Number}" />
        <DataGridTextColumn Header="ETA" Binding="{Binding Path=ETA}" />
    </DataGrid.Columns>
</DataGrid>

Seems straightforward enough, doesn’t it? Well it does but when you try to run it, it’ll crash and burn with the following exception:

InvalidOperationException: A TwoWay or OneWayToSource binding cannot work on the read-only property ‘Number’

The reason that the InvalidOperationException gets thrown is that the Binding used to bind the column to a property is a TwoWay binding, by default!

But why should (and is) this be a problem? Well, because the result from the LINQ is a new class that contains only get-properties. This is by design because an anonymous type can only contain get-only properties as is written on MSDN:

Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to first explicitly define a type.

There are two workarounds for this problem, one is simply to add Mode=OneWay to the Binding property of the DataGridTextColumn. This will tell the DataGrid (ultimately the Binding) that it should not attempt to write data back to the bound object.

The other workaround is not to use an anonymous type. If you need to be able to change data in the result set this is probably the way to go. By defining a type that contains the properties you want to bind on you can tell LINQ to return that specific type and not an anonymous one.

For example:

C#

public class VoyageResult {
    public int Number { get; set; }
    public DateTime ETA { get; set; }
}
var voyages = from voyage in entities.Voyage
              select new VoyageResult()
              {
                   Number = voyage.Number,
                   ETA = voyage.StartTime
              };

voyages will now contain a list of VoyageResults instead of a generated anonymous type (with exactly the same properties!) If you bind this list to the DataGrid it will use the default TwoWay binding without complaints.

.Net , ,

iPhone, youPhone?

June 3rd, 2009

een beetje vreemd is het wel een microsoft ontwikkelaar die geen windows mobile telefoon heeft. Je zou haast kunnen zeggen dat het heulen met de vijand is.
Eigenlijk heeft het nog een doel ook en dat is laten zien dat je zelfs op het Apple platform .Net applicaties kunt bouwen.
Eerst maar eens verder spelen voordat ik me daar aan ga wagen.
Oh en voor diegenen die al langer op een berichtje van mij zitten te wachten: eind van het weekend komt er wat aan dus even geduld nog.

.Net, Algemeen, iPhone

Bikkelen!

February 27th, 2009

3! 2! 1! duwen!! Dikke kluiten modder vliegen in het rond en dan staat die auto toch mooi boven op de heuvel. Aldus een korte samenvatting van het Bikkelweekend van de LRCH. Dit keer met een andere bijrijder dan normaal omdat Jelle, bezige baas als ie is, dit keer niet mee kon omdat ie weer eens moest werken. Gelukkig was Johnny, professioneel boomklouteraar, wel te porren voor een weekendje Land Rover geweld. En dat het echt bikkelen was bleek wel waar (en vooral hoe laat) we moesten verzamelen: 9 uur ’s ochtends bij Schaap in Lelystad! En omdat met een groepje rijden altijd beter is dan in je eentje ben ik met Robert, Jan, Harm en Sophie om 7 uur vanaf Ridderkerk vertrokken. Ergens halverwege werden Harm en Sophie de rook van mijn trouwe serie 3 toch een beetje zat en werd ik wild ingehaald. Eenmaal bij Schaap aangekomen werd ons een envelop overhandigd met een kaartje met daarop de locaties waar we een aantal proeven moesten afleggen. ’s Avonds op het campingterrein (nou ja, grasveld) werden de teams bekend gemaakt voor de trophy en gingen de team-opdrachten van start, vuurtje stoken, eiergooien, lopende-A en natuurlijk het succesnummer touwtrekken! Bij dat laatste heeft team 1 overtuigend de avond-overwinning binnen gesleept! Na een bijzonder koude nacht (onder het vriespunt) en een brommende standkachel was het dan tijd voor het spelen in de modder! Bij de 1e proef bleek al dat het niet zomaar zou gaan lukken en dat sommige boompjes toch wel erg dicht op elkaar staan en je ineens 8 dodehoekspiegels erbij hebt. Bij de op 1 na laatste proef die we gedaan hebben was Robert zo sportief om z’n auto even in de drek te parkeren waardoor team 1 op onnavolgbare wijze al touwtrekkend hem weer los probeerde te trekken. Anyhoe: een filmpje zegt meer dan de platte tekst dus aanschouw:

hatEenmaal terug in de beschaving en het “gewone” leven valt er ook nog genoeg te beleven. Vorige week vrijdag hoor je dan ineens dat de economische crisis toch ook dichtbij mensen raakt en dat Leon plotsklaps werkeloos is. De Dump bleek namelijk failliet te zijn gegaan. De uitspraak dat elk nadeel dan weer z’n voordeel heeft blijkt dan ook weer op te gaan omdat alles met 50% korting weg ging. Naast wat andere zaken heb ik dan eindelijk een rete coole hoed gekocht :D Ik lijk op het moment zo uit Australië te komen en familie te zijn van Crocodile Dundee.

Afgelopen week heb ik op m’n werk ook mijn review gehad en daar heb ik boven verwachting gescoord dus dat is weer goed voor m’n ego. Hopelijk zit daar ook nog een verbetering in van de materiele waardering maar dat zien we nog wel. Nu het voorjaar weer voor de deur staat heb ik het afgelopen weekend aangegrepen om m’n schuur eens grondig uit te mesten en de stadswerf te verblijden met al mijn ouwe troep :P Toen ik dat eenmaal voor elkaar had ben ik in 1x door gegaan naar m’n werkkamer (dat moet het worden eigenlijk) en de “geweldige” lambrisering die er in zat. Zat ja, want het is er allemaal vanaf. Het kost even wat moeite en uiteindelijk gewoon ouderwets grof geweld maar het resultaat mag er zijn. Ik moet helaas wel 1 muurtje gaan behangen want het beton is nogal, hoe zeg je dat, poreus :D Goed, dat is het weer even. Wederom een flinke lap tekst. Nu maar eens denken over hoe ik m’n nieuwe bureau ga bouwen. Ajeto!

Algemeen