People have been requesting more information about whether my previously mentioned trick to get .NET 3.5 functionality in Windows 2000 works. So far, it mostly seems to be a success although the software is still not being used on a large scale, but I have only found 1 real problem… When I made a WCF service client to access a web service, VS.NET created a section in the app.config file. This caused an exception when I loaded the program on the Windows 2000 PCs. However, I removed the section from the config file and hard coded the configuration info for the WCF client and it worked fine!
Posts Tagged ‘.NET 3.5’
More info on .NET 3.5 in Windows 2000
Thursday, September 18th, 2008Microsoft .NET Framework 3.5 in Windows 2000 Test 1
Wednesday, March 26th, 2008I mentioned earlier how to install .NET framework 3.5 in Windows 2000. I have been testing this on 7 Windows 2000 PCs, and I have successfully managed to get them to do a simple Linq to SQL query with the method that I mentioned. I can’t speak for WPF or anything, but I am currently only interested in Linq. I will post more in future when I have the live system in place.
Structured Exception Handling in .NET Part 1: Try/Catch/Finally
Thursday, March 13th, 2008A friend has asked me to write some articles on how to handle exceptions in .NET, so here we go… A little bit of background first: -
Exceptions occur when things go wrong or other exceptional circumstances. They are a bit more complicated than the older error trapping systems, but the complexity lets you do a lot with them. Every Exception is an object, and it is either an object of type Exception, or of a type that inherits from Exception.
In this post, I’m just going to deal with catching a general Exception. I’ll cover what you can do with the Exception class itself, multiple Catch clauses, different Exception types, re-throwing and creating your own Exception classes in other posts.
So here is the way it works. When something goes wrong, an Exception object gets created and “thrown”. This means that the stack rewinds back until it finds something that catches the Exception. Basically, this means that anything that gets called inside a Try clause will be handled if an Exception gets thrown. Not only that, but any functions that that calls etc. on and on either forever or until there is another Try clause that will handle it. “Later” Try clauses take precedence over earlier ones.
This is how to use it…
Try Some code Catch ex as Exception Some exception handling code Finally Cleanup code that gets called whatever End Try
Note that the Finally clause is actually optional – it is fine to leave it out. You would normally use it if you wanted to close a database connection, file, stream, network connection etc. or some other form of cleanup code. Also, you can have multiple Catch clauses, but I’ll cover that later.
- Structured Exception Handling in .NET Part 1: Try/Catch/Finally
- Structured Exception Handling in .NET Part 2: Multiple Catch Clauses and Different Exception Types
- Structured Exception Handling in .NET Part 3: The Exception Class
- Structured Exception Handling in .NET Part 4: Re-Throwing Exceptions
- Structured Exception Handling in .NET Part 5: Throwing new Exceptions
Nullables in .NET
Wednesday, March 12th, 2008I don’t know if you’ve ever had a problem with trying to store a null value in a value type in .NET. If you have, you may be interested to know that there is a generic type wrapper in .NET which can sort the problem out. It is called Nullable.
You can use it like this (in VB.NET)
Dim n as Nullable(of Integer)
You can then use the HasValue property on it to see if it has a value, and the Value property to retrieve the value. You can also assign to and from it as normal, including assigning Nothing/null to it.
Distinct in Linq to SQL
Wednesday, March 12th, 2008I was trying to get Linq to SQL to do a Distinct query today, and found that it wasn’t quite so obvious how to do it.
This works: -
From item in table Select field Distinct
This doesn’t: -
From item in table Distinct Select field
Neither does this: -
From item in table Select field.Distinct
Note that all 3 of these appear fine with Intellisense
Microsoft .NET Framework 3.5 in Windows 2000
Wednesday, March 12th, 2008Microsoft don’t support using .NET 3.5 in Windows 2000, which is particularly annoying, especially if, like me, you have a client who has 8 out of 12 PCs still using Windows 2000.
So, I decided to have a go and see if I could find any way of doing it. This is completely unsupported, and if it breaks anything, don’t blame me, but it is actually fairly straightforward and it seems to work fine to me (although I doubt it works with things like WPF, but if anyone tries it, please leave a comment to say how it goes)…
- Make sure you have Windows 2000 SP4 installed
- You may need to install KB 835732 before step 3
- Install .NET Framework 2.0 Service Pack 1
Now, there are 2 ways of continuing. Either you can copy over all the .NET 3.5 assemblies (you’ll have them on a .NET 3.5 PC in the Program Files\Reference Assemblies\Microsoft\Framework\v3.5 folder). You can either dump them in the application folder or probably register them in the GAC (not tried it, but it should work).
Alternatively, try running your application. You will probably get a load of AssemblyReferenceFailedExceptions. Copy in the required DLL from the above folder into your application folder for each one.
It should all work now!











