upgrading vb6 - warning MSB3287: Cannot load type library for reference

Posted on 2014-03-27
Last Modified: 2014-03-29
In the anticipation that we will eventually be forced off our 32-bit systems onto 64-bit ones, I am going to make a start on converting and upgrading some VB6 code.

I can open up the old VB6 projects using VS2005, and get a compile/build under way – so far, so good.

Naturally, a fairly lengthy list of errors resulted. Most I have been able to fix, but there are a few I am stuck on. The first is the error message

C:\Windows\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets : warning MSB3287: Cannot load type library for reference "AxMSMAPI". Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))

I have found MSMAPI.DLL on the c:\ drive as part of the VB6 install package, and copied it to c:\windows\system32. I have tried to register it, but it fails:
Question by:AlHal2
  • 4
  • 2
  • 2

Author Comment

ID: 39958537
The program  sucks data out of a database and uses it to build an input file. It uses some hideously complicated logic to query locale settings and automatically adjust time-stamps for different time zones. That latter bit seems to cause most of the troubles.

Expert Comment

ID: 39958920
Sorry Al this is going to be a tedious process that will drive you to drink if your not careful.  I've warned many business a type that the longer they wait  to migrate the uglier it will get. I've had to do it on a couple of occasions and it always stunk.  Are you getting a general area where the error is occuring? How may lines of code are we looking at?

Author Comment

ID: 39959174
I'm asking this question on someone else's behalf and am waiting for their response.
LVL 40
ID: 39959778
I have seen a lot of projects where programmers tried to convert a VB6 application to VB.NET. They almost all fail. Most of these projects were scrapped after a few weeks or a few months, after the programmers found out that a rewrite is most often the best solution.

The converter does what it can, but there are too many differences, specially in the design of applications. You will end up with a program that lacks performance, is hard to maintain, and does not show you how to program in .NET. You will end up with something that is neither VB6, neither .NET.

As grabber said, waiting 12 years before upgrading development tools and paradigms is "forbidden" in computer sciences.

And you seem to be falling in the net a second time. Why move from old to old. VS2005 is already 9 years old, and was not designed for 64-bit. Any testing that you do in there might blow in your face when you will really make the move.

If you absolutely want to go for a straight conversion, at least do it in a recent version of Visual Studio. If the problem is one of money, the Express edition is free from Microsoft, and will do everything than the bigger editions do for somebody who comes from VB6 and does not need the extra tools provided with the Professional or higher edition.
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.


Expert Comment

ID: 39960040
That is pretty much my take as well. There are so many structural changes between the two that finding a transition from one source to another that it is just better to use the origninal as a template for design. Sorry.

Author Comment

ID: 39961111
Do you have some vb.Net code to query locale settings and automatically adjust time-stamps for different time zones.
LVL 40

Accepted Solution

Jacques Bourgeois (James Burger) earned 250 total points
ID: 39962003
Once you have the date loaded in a variable (let's call it d), and assuming that the time zone is set properly in the configuration panel, you can use the following:

d.ToLocalTime        'From UTC to local
d.ToUniversalTime 'From local to UTC

This gives you one of the reasons why direct conversions are not good. You probably had many lines of code to do that in VB6, while it's built in the framework. The converter is not able to see those things.

Author Closing Comment

ID: 39964277

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now