Assembly binding error: binding result: hr = 0x80070002. The system cannot find the specified file.

I have a Visual Studio 2010 solution that contains a class library (ProjectA) and two Sharepoint projects (ProjectB and ProjectC). Dependency order - ProjectB links. ProejctA and ProjectC refer to both ProjectA and ProjectB.

On one specific development machine, I get the following error when trying to create ProjectC:

Compilation error. Unable to load one or more of the requested types. Get the LoaderExceptions property for more information.

When viewing the merge log, I noticed the following error:

* Record in the Binder assembly (06/14/2012 @ 09: 38: 32) *

The operation failed.

Binding Result: hr = 0x80070002. The system cannot find the specified file.

Build Manager downloaded from: C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ clr.dll

Running under the executable file C: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ devenv.exe

--- The following is a detailed error log.

=== Prebinding status information === LOG: User = DOMAIN \ username

LOG: DisplayName = ProjectB, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = aaaaaaaaaaaaaaaaa, processorArchitecture = MSIL (Fully Specified)

LOG: Appbase = file: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE /

LOG: Initial PrivatePath = NULL

LOG: Dynamic Base = NULL

LOG: Cache Base = NULL

LOG: AppName = devenv.exe

Build call: (Unknown).

LOG: This binding starts in the context of the default load.

LOG: using the application configuration file: C: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ devenv.exe.Config

LOG: Using the host configuration file:

LOG: using the machine configuration file from C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ config \ machine.config.

LOG: post-political link: ProjectB, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = aaaaaaaaaaaaaaaa, processorArchitecture = MSIL

LOG: The GAC search was unsuccessful.

LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / ProjectB / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PublicAssemblies / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PublicAssemblies / ProjectB / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PrivateAssemblies / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PrivateAssemblies / ProjectB / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / CommonExtensions / Microsoft / TemplateProviders / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / CommonExtensions / Microsoft / TemplateProviders / ProjectB / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PrivateAssemblies / DataCollectors / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PrivateAssemblies / DataCollectors / ProjectB / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PrivateAssemblies / DataCollectors / x86 / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PrivateAssemblies / DataCollectors / x86 / ProjectB / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / CommonExtensions / Microsoft / Editor / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / CommonExtensions / Microsoft / Editor / ProjectB / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / CommonExtensions / Platform / Debugger / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / CommonExtensions / Platform / Debugger / ProjectB / ProjectB.DLL. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / ProjectB / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PublicAssemblies / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PublicAssemblies / ProjectB / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PrivateAssemblies / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PrivateAssemblies / ProjectB / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / CommonExtensions / Microsoft / TemplateProviders / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / CommonExtensions / Microsoft / TemplateProviders / ProjectB / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PrivateAssemblies / DataCollectors / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PrivateAssemblies / DataCollectors / ProjectB / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PrivateAssemblies / DataCollectors / x86 / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / PrivateAssemblies / DataCollectors / x86 / ProjectB / ProjectB.EXE. LOG: attempt to download a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / CommonExtensions / Microsoft / Editor / ProjectB.EXE.LOG: attempt to download a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / CommonExtensions / Microsoft / Editor / ProjectB / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / CommonExtensions / Platform / Debugger / ProjectB.EXE. LOG: attempt to load a new file URL: /// C: / Program Files (x86) / Microsoft Visual Studio 10.0 / Common7 / IDE / CommonExtensions / Platform / Debugger / ProjectB / ProjectB.EXE. LOG: all trial URLs were tried and failed.

I tried:

  • Removing a link to ProjectB and re-adding:
    • a) as a reference to the project
    • b) as a reference guide directly to the projectB debug folder
  • Manually placing ProjectB.dll in the GAC
  • Change Copy Local from True to False (and back to True)

And only (2) placing the assembly in the GAC allows ProjectC to build. Why doesn't he find the assembly as he should (and does on other machines)?

+6
source share
2 answers

Thus, it turns out that the assembly cannot be found, because we are Delayed Signing Assemblies , which means that:

Since the assembly does not have a valid strong signature, verification of this signature should be disabled. You can do this using the -Vr option with the Strong Name tool.

I already did this for all the necessary public keys, but ONLY on the x64 Visual Studio command line. I also needed to add validation gaps for x86 to the x86 version of the Visual Studio command line.

I managed to find this only because when I tried to create / deploy based on a specific script command, I noticed the following exception from one of the test assemblies:

Failed to load the file or assembly ProjectC.Tests, Version = 0.0.0.0, Culture = Neutral, PublicKeyToken = e72f8d3506b83180 'or one of its dependencies. Failed to perform strong name validation. (Exception from HRESULT: 0x8013141A)

+3
source

PublicKeyToken = aaaaaaaaaaaaaaaaa may be different or may differ from the version number of the assembly. I think you should use the Fusion Log Viewer to debug as described, and hope that you fully solve your problem.

+3
source

Source: https://habr.com/ru/post/918075/


All Articles