tags:

views:

251

answers:

5

Hi all,

I've got a really strange error and any light that anyone can shed on this would be greatly appreciated. We're under the gun (as usual) and I need to find an answer for this quickly.

I made some changes to some VB6 source which builds a COM object. The automated build which builds our app returned an error. No problem I thought--I'll just back out my changes. Well backing out my changes isn't making the problem go away.

Specifically when I attempt to build the app via a .vbg file, with a command line like path to vb6\vb6 ProjectFile.vbg /make

I get a message

"Compile Error in File '', Line : Object library invalid or contains references to object definitions that could not be found."

As I said, I reverted the source code so I'm really stumped as to why this error is still occurring. Any VB6 gurus around who might be able to point me at an answer? I can post the exact code in question but the fact that it was building correctly, stopped building correctly and now refuses to build correctly makes me think this is not a problem with my code but rather some problem in the environment. Like something got put in the registry as a result of the previous build error.

Any tips, hints, or suggestions greatly welcome. I realize my question is a bit sketchy but I'm not even sure what's important to include and what isn't.

EDIT:

Thanks for the excellent suggestions guys. I think it is something to do with VB6 doing some sort of auto-registration.

Just to add a bit more detail: this problem does not occur when I build the referenced vbp file from the IDE. It only happens on the make on the .vbg which contains the vbp. Also the build tool in question automatically pulls latest source and the error happens on both my local box and the dedicated build box.

EDIT 2:

Hi again all,

The release engineering fellow figured out how to get this to build in his build environment so it's currently ok. Once we're past this crunch, I'll try to interrogate him about what he did and share the details with everyone. Thanks again for all the great suggestions. This is what's so great about SO; that is, I asked about a 10-year-old technology and I got several great and on-point ideas.

A: 

Hunt down and delete any .obj and .exp files that may be lying around from the previous failed build.

AnthonyWJones
Good thought but I didn't think that VB's make made .obj or .exp files. But I'll double check this, thanks.
Onorio Catenacci
Nope--didn't do a thing.
Onorio Catenacci
+5  A: 

Make sure that the VBG and all the VBP's got rolled back as well. That error is consistent with a project trying to reference a CLSID that is no longer valid for the dependency. Have you tried loading up the project group and building from the IDE, if that works and you save and check in all the changes to the group and project files, you might be fixed up.

cmsjr
@cmsjr, I did open up the VBG via the IDE did a build and the /make is now working. But for the life of me I don't understand this. Does VB do a silent check out of the .vbp files? I guess somehow I must have accidentally checked in a VBP file.
Onorio Catenacci
You know I may have accidentally saved a .vbp but I know I didn't accidentally save the .vbg file because I never open it up. It's used by a separate automated build process. It's not been changed in years.
Onorio Catenacci
I don't think it does any silent check outs, it does do some weird project by project tracking that can causes issue, hard to say.
cmsjr
The VBG just stores relative paths to VBPs, and the VBPs store all the dependency info. Does your build tool get latest when it does a build. Also, were you running the build tool locally or on another system?
cmsjr
I should note, that doing it via the IDE probably worked because the IDE can resolve the project dependencies based on the current project contents when it does it's build, then after you save the project files, you can do automated builds until something else disruptive occurs.
cmsjr
@cmsjr:Build tool does pull latest files automatically.Build tool runs on a different machine and it fails on both.
Onorio Catenacci
So wait, you can do a command line make locally, but the build tool still fails regardless of where you run it ? That sounds like you need to check in your vbp changes to source control.
cmsjr
forms store the CLSID as well. This type of error can appear random because of changing compatibility DLLs. See my answer for more detail.
RS Conley
+1  A: 

I'm guessing the fact that you mention that it was a COM component might be the source of the problem. If any of the public method's or properties have changed then I seem to remember that VB6 will change the interface GUIDs and auto register the new ones.

My suggestion would be to check the registry to look for any mention of the component name, make a note of any associated CLSIDs, back up the registry, and then delete the references.

As cmsjr mentions it could also be a bad CLSID reference in your .vbp files.

The other option is that the failure has caused a problem with some .tlb (type library) or olb (object library) files.

Frozenskys
A: 

You will have to open the project & re-type in the lines that you changed.
Save the project alongwith VBG and re-compile after that.

I think that will fix it.

EDIT: The idea is that the cls/bas file remember the class (CLSID) that you used. So, if you change the references but don't change the lines in the cls/bas - it is a mismatch of type (what was referenced vs what is typed in cls/bas file).

shahkalpesh
+1  A: 

The best thing to do is move all your compatibility DLL to a separate and combined directory. The reason for this is control over what VB6 is using to check for binary compatibility. In addition the Typelibs that are generated IMPORT the references. So if you using Binary DLL Ver 10 for compatibility however the import is pulling in Binary DLL Ver 9 you will have issues. By keeping all the libraries in a single folder and pointing your projects to the DLLs in that folder you ensure that the respective TypeLib Import the correct version.

Finally if you have multiple levels of DLL reference each other. You may run into mysterious error where the VB6 is unable to compile using binary compatibility. In such cases you need to compile the lowest DLL in the hierarchy (Utility DLL perhaps) copy it over into the compatibility folders. Work your way up the chain until everything compiles in one shot again.

This is because if have DLL A reference DLL B which Reference DLL C. VB6 will get sometimes get confused if you make a change to A and C. will compile fine but A will not until the compatibility libraries are updated.

RS Conley