Wednesday, November 14, 2007

Comparing DateTime structs ...

Consider the following code:

DateTime localTime = new DateTime(2007, 11, 14, 12, 0, 0, DateTimeKind.Local);
DateTime utcTime = new DateTime(2007, 11, 14, 12, 0, 0, DateTimeKind.Utc);

System.Diagnostics.Debug.Print("Is equal ? {0}", localTime == utcTime);

What do you expect the answer to be?


...and you probably guessed wrong as .NET actually considers them to be equal !?!


MSDN is "somewhat fuzzy" on the subject:


"Calculations and comparisons of DateTime objects are only meaningful if the objects represent times in the same time zone. For that reason, if no time zone is specified for the objects, it is assumed that the developer has some external mechanism, such as an explicit variable or policy, that can be used to determine the time zone in which a DateTime object was created."


Monday, November 05, 2007

Visual Studio 2008 release imminent

S. Somasegar (Corporate Vice President, Developer Division) just announced at Teched Barcelona that Visual Studio 2008 (and .NET 3.5 Framework) will be shipped before the end of November 2007.

Nice!

Sunday, November 04, 2007

Google translation

Niklas Jansson pointed out that Google managed to screw up the translation of the Calendar print dialog.

The orientation combo box in Swedish has the choices "Bil", "Stående" and "Liggande", the last two makes sense but the first one translating to Car obviously does not. (The original version says auto.)

Funnily enough, they managed to screw up the Finnish version too, where they for the same alternative provided "Autot" which means "the cars", (while auto might actually have been somewhat acceptable).

Well, you can't always win... :)

Integrating Help2 files into VS 2005 - part 2

The other workaround I hinted in the previous post involves a bit of manual labor the first time (or if you ask nicely, I might just provide the needed parts), if used more than once it is IMO less painful than the ORCA route.

This solution takes advantage of <CustomTable> feature of WiX. By "reverse engineering" the needed table schemas out of the relevant merge module MSHelp2_RegTables__RTL_---_---.msm we can author these tables as <CustomTable>:s and then just add <Row>:s as appropriate.

Next time just edit the row data and you're set.

For brevity, I just post one table here, but the rest can be made available upon request.

The tables I've used are HelpFile, HelpFileToNamespace, HelpNamespace and HelpPlugin.

      <CustomTable Id="HelpFileToNamespace">
<!--
HelpFileToNamespace table definition -->
<
Column
Type="string"
PrimaryKey="yes"
Id="HelpFile_"
Nullable="no"
KeyTable="HelpFile"
KeyColumn="1"
Category="Identifier"
Description="Foreign key into HelpFile table (required)." />
<
Column
Type="string"
Width="72"
PrimaryKey="yes"
Id="HelpNamespace_"
Nullable="no"
KeyTable="HelpNamespace"
KeyColumn="1"
Category="Identifier"
Description="Foreign key into HelpNamespace table (required)."/>

<!--
data -->
<
Row>
<
Data Column="HelpFile_">YourHelpFileKey</Data>
<
Data Column="HelpNamespace_">YourHelpNamespaceKey</Data>
</
Row>
</
CustomTable>

Saturday, November 03, 2007

Integrating Help2 files into VS 2005 - part 1

For various reasons (curiosity among others) I've been playing with integrating custom API documentation into Visual Studio, this turned out to be rather laborious.

For future reference I thought I'd document the process here.

- Create the code to be documented, use xml comments and turn on the generate xml comments switch in the project settings.

- Install Visual Studio SDK (yes, really ...)

- Install Sandcastle

- Install Sandcastle Help File Builder

- Open SHFB and create a Help2 project and customize appropriately.

- When the project builds successfully, open all the various .Hx? files (except .HxS) and remove the DTD reference, and from the .HxC file also the <CompilerOptions> element including contents. (For further info refer to the helpware site.)

- Now Microsoft wants you to use the Help Collection Integration Wizard, or manually edit merge files with Orca, neither of which is any fun.

- WiX has a WixVSExtension that among other thing has <HelpFile>, <HelpFileRef>, <HelpCollection> and <PlugCollectionInto> elements which sound promising.

- The problem: the WixVSExtension is currently broken, specifically bug 1588180 

- The bug comments include a suggested fix that involves recompiling WiX. Due to dependency issues this seems like a PITA.

- There is however also another workaround ... stay tuned!

Sunday, October 28, 2007

Dependency Visualizer - now on CodePlex

I finally released Dependency Visualizer as open-source on CodePlex. It's new home is now there.

Thursday, October 04, 2007

Microsoft to release the source code for the .NET Framework Libraries

 

I'm definitely not the first (and probably not the last) one to blog about this, but Microsoft is about to release the source code for a big part of the .NET framework. Yay! Even though Reflector is nice, having the actual source code with comments is nicer.

Read more here:

Releasing the Source Code for the .NET Framework Libraries - ScottGu's Blog