I'm working on a very large Visual Basic system. It contains many DLLs and EXEs that use Interop to move between VB6 COM components and VB.NET 2003 components. We recently started upgrading the VB.NET 2003 portions of the system to VB.NET 2005 and are now getting an unexpected error during compilation.

The error message seems to indicate that an assembly is missing a manifest. The problem is that the indicated file is not a .NET assembly. It is a VB6 dll. The indicated file is also not directly referenced from the project that we are attempting to compile. It is referenced from another DLL that is also a VB6 DLL. My best guess as to what is going on (purely conjecture) is that the compiler has become confused about what type of component is being loaded and is trying to enforce the rules for a .NET component on a COM component.

A bit more info on how we are making our references...

For .NET dlls, we run "REGASM /codebase xxx.dll /tlb:Relius.Admin.xxx.tlb" to create TLBs that we reference from VB6.

For COM dlls, we run "TLBIMP xxx.dll /OUT:Relius.Admin.xxx.dll /Namespace:Relius.Admin.xxx /asmversion:13.0.0.0" to create a RCW and then reference the Relius.Admin.xxx.dll from our DOTNET projects.

These procedures have worked in the past with VB.NET 2003 but it seems that VB.NET 2005 is having problems with this approach.

The error message follows:

Error 1 The "ResolveAssemblyReference" task failed unexpectedly.
System.BadImageFormatException: Could not load file or assembly 'C:\Relius\Admin\V13.0\QTSQLMap.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
File name: 'C:\Relius\Admin\V13.0\QTSQLMap.dll'
at System.Reflection.AssemblyName.nGetFileInformation(String s)
at System.Reflection.AssemblyName.GetAssemblyName(String assemblyFile)
at Microsoft.Build.Shared.AssemblyNameExtension.GetAssemblyNameEx(String path)
at Microsoft.Build.Tasks.SystemState.GetAssemblyName(String path)
at Microsoft.Build.Tasks.Resolver.FileMatchesAssemblyName(AssemblyNameExtension assemblyName, Boolean isPrimaryProjectReference, Boolean wantSpecificVersion, Boolean allowMismatchBetweenFusionNameAndFileName, String pathToCandidateAssembly, ResolutionSearchLocation searchLocation)
at Microsoft.Build.Tasks.Resolver.ResolveAsFile(String fullPath, AssemblyNameExtension assemblyName, Boolean isPrimaryProjectReference, Boolean wantSpecificVersion, Boolean allowMismatchBetweenFusionNameAndFileName, ArrayList assembliesConsideredAndRejected)
at Microsoft.Build.Tasks.Resolver.ResolveFromDirectory(AssemblyNameExtension assemblyName, Boolean isPrimaryProjectReference, Boolean wantSpecificVersion, String[] executableExtensions, String directory, ArrayList assembliesConsideredAndRejected)
at Microsoft.Build.Tasks.DirectoryResolver.Resolve(AssemblyNameExtension assemblyName, String rawFileNameCandidate, Boolean isPrimaryProjectReference, Boolean wantSpecificVersion, String[] executableExtensions, String hintPath, String assemblyFolderKey, ArrayList assembliesConsideredAndRejected, String& foundPath, Boolean& userRequestedSpecificFile)
at Microsoft.Build.Tasks.AssemblyResolution.ResolveReference(IEnumerable`1 jaggedResolvers, AssemblyNameExtension assemblyName, String rawFileNameCandidate, Boolean isPrimaryProjectReference, Boolean wantSpecificVersion, String[] executableExtensions, String hintPath, String assemblyFolderKey, ArrayList assembliesConsideredAndRejected, String& resolvedSearchPath, Boolean& userRequestedSpecificFile)
at Microsoft.Build.Tasks.ReferenceTable.ResolveReference(AssemblyNameExtension assemblyName, String rawFileNameCandidate, Reference reference)
at Microsoft.Build.Tasks.ReferenceTable.ResolveAssemblyFilenames()
at Microsoft.Build.Tasks.ReferenceTable.ComputeClosure()
at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute(FileExists fileExists, DirectoryExists directoryExists, GetDirectories getDirectories, GetAssemblyName getAssemblyName, GetAssemblyMetadata getAssemblyMetadata, GetRegistrySubKeyNames getRegistrySubKeyNames, GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, GetLastWriteTime getLastWriteTime)
at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound)

Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = CORBEL\kenb
LOG: Where-ref bind. Location = C:\Relius\Admin\V13.0\QTSQLMap.dll
LOG: Appbase = file:///C:/Program Files/Microsoft Visual Studio 8/Common7/IDE/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This is an inspection only bind.
LOG: Using application configuration file: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe.Config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Attempting download of new URL file:///C:/Relius/Admin/V13.0/QTSQLMap.dll.
ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.
Relius.Admin.Bus.Cafeteria