Friday 19 November 2010

Crystal Reports - Could not load file or assembly 'System.Web.Extensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies

I was upgrading an old ASP project that used crystal reports and came across the following error:

Could not load file or assembly 'System.Web.Extensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.

This was caused by the project being upgraded to use .net 3.5. As i wanted to use .net 3.5 i could not downgrade it to version 2.0. Luckily I found some information on the web for assembly binding redirection that is configured in the web.config. Making the changes below solved the problem.

old web.config entry

new web.config entry


This is basically telling ASP to redirect calls to any System.Web.Extensions dll from version 1 to version 3 to go to version 3.5. Before it was only redirecting .net 1 and .net 1.1 calls to .net 3.5.

Monday 15 November 2010

Visual Studio Color Theme Editor Crashes Visual Studio after applying a theme

I have been playing around with the Visual Studio Color Theme Editor extension and come across a problem where Visual Studio crashes every time I try and load a theme file to apply.
Its fairly obvious when its going to crash as after the theme has loaded into the list and the apply button is clicked is does not disable the apply button afterwards.

Ended up running process monitor to find the files or registry keys this is using and found

Deleting this key fixed the problem with visual studio crashing so I can now load new themes.

NOTE: This also removed all of the other custom saved themes

Friday 12 November 2010

Using LINQ to Sort Data

Usually to sort objects with a Sort() method on a list the objects need to have a Comparer class that is used to compare the object types. This is fine but gets old fast when having to implement this multiple times for different object types.

This is where Linq comes in

Take a look at this method below: I cant sort in SQL as the properties I need to sort on don’t exist in the table.