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]
 Thursday, December 07, 2006

When using the GridView, you can specify an “EmptyDataTemplate” to display when there is no data specified in the DataSource. This is great, but the problem from my point of view is that the column headers are not displayed. I would like them to be displayed, even if there is no data.

In my search for the solution I found the following article which explains how to achieve this result by overriding CreateChildControls:

http://www.dotnetslackers.com/GridView/re-27953_Displaying_GridView_When_No_Data_Exists.aspx

 

posted on 12/7/2006 6:22:08 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Tuesday, November 28, 2006

To support Web Farms (multiple machines) or Web Gardens (multiple processors), changes to the ASP.NET configuration will need to be made. Thankfully this is just configuration; no code changes would need to be made.

The main thing to be aware of when setting up for a farm/garden is that a user's request can hit any processor or server. As such, the user's session needs to be available across the entire farm/garden and so session state cannot be held locally in memory, which is the default configuration.

The following links give further details on what can be involved:

Session-State modes: http://msdn2.microsoft.com/en-us/library/ms178586.aspx
Web Garden Model: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/dngrfTheASPNETHTTPRuntime.asp

posted on 11/28/2006 7:23:57 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Friday, November 24, 2006

I was forwarded the following link to a pretty comprehensive list of online generators.

http://www.smashingmagazine.com/2006/11/09/online-generators/

It seems there’s one for any occasion. I particularly like the ColorBlender.com which will give you a colour matching palette based on a preferred starting color. Perfect for those of us not trained in Graphical Arts to produce something aesthetically pleasing!

ColorBlender.com screenshot
posted on 11/24/2006 6:18:42 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Tuesday, November 21, 2006

It's not an error message that you see often when working with ASP.NET, but if you’re deploying to a new, clean machine, it can happen quite easily.

Failed to access IIS metabase screenshot

The problem comes around due to the order that components were installed on the machine, namely that The .NET Framework was installed before IIS. As a result, ASP.NET is not correctly configured to run. The easiest way to rectify this is to re-install ASP.NET with IIS.

aspnet_regiis –i

If you only require default settings then this is the easiest option. The Microsoft KB specified in the error message suggests the –ga switch, but that requires a little more knowledge of the Windows system as it requires you to specify the Windows User Account to run under (which is different between Windows 2000, XP, 2003, etc). Easier to simply use the –i switch!

posted on 11/21/2006 5:46:12 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, September 22, 2006

I discovered today Microsoft's version of online mapping, Live Local, which competes directly with Google Maps and here in NZ SMaps (aka Zoomin). They all use the same AJAX whizzy UI components, but there are a few things which set it apart from the rest of the crowd.

Here in NZ, we often end up at the bottom of the list for updating country specific features. Take Google Maps for example, which does not have the geocoding facilities to find anything but the main centres. This is where SMaps (Zoomin) have done a great job in taking the same mapping style, but adding the street level geocoding we need.

What I like about Local Live is that it now not only has the geocoding for NZ, but the driving directions too, which are not possible in any of the other products. It works great too and from what I've seen so far, it's pretty accurate. Of course it works slightly better in IE than in other browsers, but really (be honest!) is that really a problem for anyone? I also like how on the first page load, it knows roughly where you are in the world, so it can centre the map. Give it your IP address or use a plugin, it can locate your computer too.
posted on 9/22/2006 6:42:37 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]