Monday, February 19, 2007

I've been meaning to look more into building a Sidebar Gadget in Vista for a while now. I just happened to come across a post from Nikhil Kothari's blog entitled Authoring Sidebar Gadgets in C#. I don't really have the time to the follow longer, in-depth tutorials you see around and was interested to see how his Script# project allowed the use of C# when building a Gadget. Worth a closer look I think.

posted on 2/19/2007 8:00:45 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Tuesday, February 06, 2007

As your solution grows, the number of assemblies you have will undoubtedly grow too. Updating the version numbers of all those assemblies by their projects AssemblyInfo.cs files can be a hassle. However, there is a way to change the version in just one file, but have that change affect all project assemblies!

By using a “link” file in your projects, you can include a file from a shared location that contains only the version information.

  • Add a new file named VersionInfo.cs
  • Add to this file only the version information from an existing AssemblyInfo.cs file
    Screenshot showing sample VersionInfo.cs<
  • Add VersionInfo.cs as a solution item

Now, for each project that you wish to include this version information:

  • Select “Add Existing Item…” on the project menu
  • Browse to VersionInfo.cs file
  • Click the down arrow on the “Add” button and choose “Add as Link”
    Screenshot showing 'Add As Link' button
    The file will have the shortcut icon when you look at the project files.
    Screenshot showing VersionInfo.cs in soultion
  • Remove any version information from existing AssemblyInfo.cs

When then assembly is built it will essentially have the combined attribute values from the AssemblyInfo.cs and VersionInfo.cs file.

Now you only have to change the version in one place and all projects will get it :-)

posted on 2/6/2007 9:47:37 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Monday, November 20, 2006

I’ve been using NMock 1.0 as part of my normal TDD (Test Driven Development) routine for a while now. I’d heard that there was a new version available a couple of months ago, but I saw no benefit in making the switch. For a start, the syntax was radically different and I was reluctant to invest time in seeing how to use it.

 

Well, I finally got around to using NMock 2.0 and after much searching, found a link to the site: http://nmock.sourceforge.net.

 

That link was surprisingly difficult to track down I can tell you … numerous dead-links and empty websites all over the place! I had to cheat in the end and ask a friend for it (thanks Neil)!

 

The new syntax has grown on me after an initial distaste for it. It may look more complicated and cumbersome than previously, but it is actually more usable once you get into it. The only issue I have with it is that the failure messages are very verbose, which can make it a little difficult to see what is going on, but I guess you get used to that too.

posted on 11/20/2006 5:54:22 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Friday, November 17, 2006

When you're developing and testing your system, you'll want to test that any emails sent are actually being sent to the SMTP server correctly: the html format is all ok; email from and email to are correct; etc.

 

An easy way to do this is by configuring .NET to drop the emails you send to a specific folder. As long as you’re sending your emails via SmtpClient and are configuring it via the web.config file (if not, why not?), the following configuration section will set up the email folder:

<system.net>
   <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory">
         <specifiedPickupDirectory pickupDirectoryLocation="C:\Temp\EmailPickupFolder"/>
      </smtp>
   </mailSettings>
</system.net>

If you then browse to the folder, you’ll see files like below. When opened in notepad, you’ll see the email in it’s raw format, or if you need to check any Html formatting, you can open it in Outlook Express.

 

Notepad View

Outlook Express View

posted on 11/17/2006 12:04:22 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Friday, July 28, 2006

I always thought it was strange that the “Build Code Comments” feature was missing from VS2005. What with the alternative comment generators being unable to cope too well with .NET 2.0 code, we were left with little option. NDoc was the best of the lot, but still had a couple of problems with generics and it was difficult to find a good working version to tweak.

Good news however. The first CTP of Sandcastle (which I assume is just the codename) will be released by Microsoft later this month or early next.

It’s what they use internally for their MSDN content so it can’t be at all bad, although why couldn’t it have been released sooner with the launch of VS2005 I don’t know?

Interestingly too, Kevin Downs, the developer behind NDoc, has apparently announced that he is no longer going to be working on NDoc.

Update:
You can now download it from here.

posted on 7/28/2006 7:18:07 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Tuesday, July 04, 2006

I was shown a nice little trick today by a collegue who was trying to debug a Windows Installer CustomAction. The problem of course is that you can't debug the code because it is being launched and controlled by the Windows Installer/MSI. The trick is to add the line below somewhere in the code:

System.Diagnostics.Debugger.Break();

When this line is executed an "exception" is thrown, which launches the Visual Studio dialog asking you if you wish to debug the process as there is an exception. Now you can simply attach to your Visual Studio session and debug your code as normal! Nice trick, that after nearly 5 years of working with .NET, I had not come across.

It's worth noting that execution will continue after the Break method is called, so you need to have a normal breakpoint ready when you attach to the VS session.

posted on 7/4/2006 9:41:06 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Monday, July 03, 2006

I discovered today that Microsoft has launched MSDN Wiki . I was using fxCop and reading into some of the details for the rules that it said I was breaking :-). Normally you are taken to msdn2 help system, but was instead taken to the Wiki version.

The core reference is taken from exactly the same database as all the other MSDN help systems, but currently can only seemed to be accessed via the web site. I've always found the online documentation from Microsoft difficult to search and navigate, so I tend to use the thick client version of MSDN Library. It would be good to be able to link to the MSDN Wiki from the thick client (for online help searches of course) to make it a little better for searching.

All in all, it's such a great idea to be able to amend the documentation. I've lost count of the number of times that the .NET Compact Framework documentation was incorrect, misleading or just plain missing! However, until they make it easier to search, I'll be sticking to MSDN Library, but will be keeping tabs on the blog for updates.

posted on 7/3/2006 10:00:11 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Monday, June 26, 2006

It's taken a while, but I finally found a blogging system that I liked.

ThinkJot is an ASP.NET 2.0 version of the latest release of the dasBlog engine. The reason for the split is that when running under ASP.NET 2.0, your site is running by default under "Medium Trust" rather than "Full Trust", which was the case in .NET 1.1. If you're running on a shared host as I am here, you'll probably find that it is running under the default security settings. No problem you think ... well, try running dasBlog 1.8 under "Medium Trust" and you'll find it doesn't work! It turns out that even things such as the date picker used, did some things that needed to run under Full Trust. For the full story go to the blog.

That's where ThinkJot comes in. It was simply a rebuild and tweak to make it ASP.NET 2.0 and Medium Trust friendly. I pass my thanks on now to the guys at Process64 who did this, you saved me a job!

posted on 6/26/2006 10:23:58 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]