Tag Archives: programming

‘Class Not Registered’ in VS2008 on x64

Took a while to figure this one out, but in hindsight, it’s painfully obvious. I switched from XP 32-bit to Win7 64-bit last week, and just got Visual Studio loaded back up. I opened up one of my projects, hit run, and started getting COM exceptions about a class not being registered.

After a while, I finally found that the default compile options will compile for ‘Any CPU’, which will compile your project for the CPU you are on currently. You can change this by going into your project properties, Compile tab, and clicking Advanced Compile Options. Setting the Target CPU to x86 solved the problem for me.

Not all COM components will require this. It just so happened that one I was using was designed for 32-bit development environments only.

Unused SQL Query

I was moving some of my code to .Net 3.5 earlier this week and cleaning up some of the migration issues. One of the warnings was that readJobs was an unused local variable. Not too unusual, till I found that it was this gem it was referencing:

Dim readJobs As SqlDataReader = cmdJobs.ExecuteReader(CommandBehavior.Default)
While readJobs.Read()
End While