views:

385

answers:

5

I am getting an error about the assembly "C:\Ora10g\bin\Zip.exe". The trouble is this solution does NOT use anything in Oracle at all. I could not find a single reference to 10g anywhere in the project. I inherited this from another person who left our group. He never had this issue. Another member of my team said he got this before but reinstalling the client portion of 10g fixed it. No such luck there. I even tried using WinGrep to search the entire solution folder for "Ora10g" but it wasn't there.

Any ideas? I can't build this solution until I can figure out how to get rid of this false reference to Oracle.

VS 2005 solution. Contains a couple WinForm apps, a couple class libraries, and a web service. The error occurs in the main class library project.

Here is the error message:

Error   1   The "ResolveAssemblyReference" task failed unexpectedly.
System.BadImageFormatException: Could not load file or assembly 'C:\Ora10g\bin\Zip.exe' or one of its dependencies. The module was expected to contain an assembly manifest.
File name: 'C:\Ora10g\bin\Zip.exe'
   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.AssemblyFoldersResolver.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.ReferenceTable.ComputeClosure(DependentAssembly[] remappedAssembliesValue, ITaskItem[] referenceAssemblyFiles, ITaskItem[] referenceAssemblyNames, ArrayList exceptions)
   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)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
A: 

When you reinstalled your Oracle client, where did you put it? If you used the default location from the installer, your ORACLE_HOME will not be at c:\ora10g. Does the directory c:\ora10g\bin exist?

A possible workaround is to create the directory c:\ora10g\bin, and copy the zip.exe file from your ORACLE_HOME\bin directory there. There is apparently something in your project that references the Oracle zip binary in that specific location (can't help you there).

DCookie
The directory exists and has the files in it. The only difference is that the folder is BIN instead of bin.The problem is this file is NOT (or SHOULD NOT be) used by this solution AT ALL. I can not find any reference to it anywhere, especially not in the library the error is getting thrown on.
bdwakefield
A: 

This file may be referenced by one of your referenced assemblies causing an indirect dependency.

Check if the file exisits in the directory and if it does, ensure the file also exists in the build server.

Ramesh
File exists, no build server.
bdwakefield
+3  A: 

The give-away's are "The module was expected to contain an assembly manifest" and the fact that the exception is of type System.BadImageFormatException. Something is trying to load the file "C:\Ora10g\bin\Zip.exe" as if it was a .net assembly and it either:

  • Isn't a .net assembly
  • Is a .net assembly but for a version of the CLR that is later than the one you're targeting
  • Is a .net assembly, but for the wrong "bitness" (unlikely given the "assembly manifest" part of the exception message).
  • Is corrupted

Have you:

  1. Examined your Solution file (.sln) in a text editor to look for references to this file?
  2. (More likely) Examined the .csproj file for the class library to see if it contains any references to this program? It could be that there's a custom MSBuild task that's trying to load that EXE, possibly to produce ZIPped output from the build process.
  3. Verified that none of the assemblies that you load themselves reference, either directly or indirectly, the Zip.exe file?
  4. As Dave Van den Eynde said, have you checked that the system .targets files (the files that tell MSBuild how to do what it does) are unchanged? You can find these files in %windir%\Microsoft.NET\Framework\v2.0.50727

Other things you can try:

  1. Follow the instructions in the error message and turn Assembly binding logging on, then review the log to see what Zip.exe was loaded as a dependency of.
  2. "Grep" your whole harddrive for "zip.exe", something, somewhere is referencing it and it may not be in your project/solution (see point 4), but it may be somewhere else that the installer for the Oracle Client has damaged/altered.
Rob
+1 - Excellent options.
Ramesh
@Ramesh, thanks :) Having done battle with a project file that "did something strange" myself before I know just how frustrating it can be. The one I was working with was invoking an EXE which Kaspersky decided meant that DEVENV was exhibiting viral behaviour and promptly closing it. It drove me barmy trying to work out! I was unaware of MSBuild then - needless to say I know a lot more about it now....
Rob
Another team member said he had gotten around it by re-installing Oracle. That did not work for me. I couldn't find any reference in the project files to Oracle.My guess is something was corrupted. I upgraded to VS2008 as we had planned to anyway and other than it changing the name of an XSD file everything seemed okay. I was able to build without error.What happens in the upgrade process that might have affected the project?
bdwakefield
It might be that the upgrade process strips out custom build tasks (although that would surprise me as it'd be a major problem for anyone who has custom build tasks). I think it's something environmental, but without picking through your machine, pre-upgrade, it's really difficult to tell. It could be that you had something in the GAC that was referencing the zip.exe, that got replaced during the VS2k8 installation... I guess we'll never know though! At least the upgrade solved your problem though :)
Rob
If it was in the GAC wouldn't if affect other projects? We have 5 or 6 that are very similar and use the same in-house developed frameworks. I would have thought something in the GAC would get tripped up on the other projects too. At least the upgrade worked. Guess I will have to live with the mystery of not knowing how it got messed up in the first place! Is there a tool to "analyze" the GAC?
bdwakefield
A: 

Also, make sure none of the official Targets files were changed. These are automatically imported in your build environment. Perhaps you could do a grep on them as well?

More specifically, your predecessor could have modified them to include some kind of build step into all of his projects.

Dave Van den Eynde
A: 

Is your application actually in the c:\ora10g directory? If so .Net is going to try and load every assembly in the \bin directory whether you actually reference it or not.

Chris Lively
All of my projects are in a different directory. C:\Visual Studio 2005\Projects.
bdwakefield