RESOLUTION
To resolve this problem, you can use the
/Regfile option together with the
Regasm command. Use
/Regfile and
Regasm to generate the .reg file that has the required registry
information. Then, you must:
- Manually edit the decimal value of the version
number.
- Change the decimal value of the version number to the
corresponding hexadecimal value.
- Run the .reg file.
Note When you use the Regasm tool with the
/RegFile option, the registry information for the Primary Interop Assembly
is not updated in the registry. This occurs because the Regasm tool depends on
Oleauto32.dll to register the type library. The registry information that is
added by Oleauto32.dll is not written to the .reg file when you run the Regasm
tool and you use the
/Regfile option. Therefore, you must run the Regasm tool one time without
using the
/Regfile option. This updates the details to the registry. Then, run the
Regasm tool again with the
/Regfile option. This permits you to access the .reg file. You can edit
the .reg file to make your modifications and then run the .reg
file.
For example, assume that the library name is Test.dll. To
resolve the problem, follow these steps:
- Move to the Microsoft Visual Studio .NET command
prompt.
- Change the directory to the folder where Test.dll
exists.
- Type this command to add the information to the registry:
regasm Test.dll.
- Type this command and then press ENTER: regasm
Test.dll /regfile:Test.reg
This creates the .reg file for
the library. - At the command prompt, type this command and then press
ENTER: Notepad Test.reg
This opens
Test.reg. - Locate this entry for the Primary Interop
Assembly:
[HKEY_CLASSES_ROOT\TypeLib\{TypeLib ID}\Version Number] - Replace the decimal number for the version with the
hexadecimal number. Save the file.
- Type Test.reg at the command prompt.
Press ENTER to update the registry information.
Note You can find the hexadecimal number that corresponds to a decimal
number if you use the Microsoft Calculator in scientific mode.