2012-06-04 101 views
15

Tengo un problema extraño con la implementación de una aplicación, que hace referencia a un ensamblado, escrito en C++ administrado.System.IO.FileNotFoundException: No se pudo cargar el archivo o ensamblado 'X' o una de sus dependencias al implementar la aplicación

He creado un ensamblado X, lo compilé y lo hice referencia en un archivo exe, llamado Starter.

Starter.exe se inicia normalmente en el mashine local. Sin embargo, al copiar todo el contenido de la carpeta de arranque de depuración a un cajero virtual, y tratar de empezar allí, se estrella con excepción siguiente:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or 
assembly 'X' or one of its dependencies. The specified module could not be found. 

Esto no tiene ningún sentido para mí, porque X es correcto en la misma carpeta que Starter.exe.

¿Qué podría estar causando este problema?

ACTUALIZACIÓN

He examinado las dependencias de reflector en la máquina objetivo, y era capaz de encontrar archivos para todos aquellos.

También cambié las configuraciones a x86/win32 para todos los proyectos.

ACTUALIZACIÓN

Aquí son los registros de la fusión Log (ubicación: C: \ FusionLog \ Default \ Starter.exe \ X, versión = 1.0.4538.22813, Culture = neutral, PublicKeyToken = null.HTM) :

*** Assembly Binder Log Entry (6/4/2012 @ 1:56:13 PM) *** 

The operation was successful. 
Bind result: hr = 0x0. The operation completed successfully. 

Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll 
Running under executable C:\Documents and Settings\Administrator\Desktop\tmp\k;k\Starter.exe 
--- A detailed error log follows. 

=== Pre-bind state information === 
LOG: User = MENKAUR-7683827\Administrator 
LOG: DisplayName = X, Version=1.0.4538.22813, Culture=neutral, PublicKeyToken=null 
(Fully-specified) 
LOG: Appbase = file:///C:/Documents and Settings/Administrator/Desktop/tmp/k;k/ 
LOG: Initial PrivatePath = NULL 
LOG: Dynamic Base = NULL 
LOG: Cache Base = NULL 
LOG: AppName = Starter.exe 
Calling assembly : Starter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. 
=== 
LOG: This bind starts in default load context. 
LOG: Using application configuration file: C:\Documents and Settings\Administrator\Desktop\tmp\k;k\Starter.exe.Config 
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\config\machine.config. 
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). 
LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/tmp/k;k/X.DLL. 
LOG: Assembly download was successful. Attempting setup of file: C:\Documents and Settings\Administrator\Desktop\tmp\k;k\X.dll 
LOG: Entering run-from-source setup phase. 
LOG: Assembly Name is: X, Version=1.0.4538.22813, Culture=neutral, PublicKeyToken=null 
LOG: Binding succeeds. Returns assembly from C:\Documents and Settings\Administrator\Desktop\tmp\k;k\X.dll. 
LOG: Assembly is loaded in default load context. 

los únicos errores se encuentran en C: \ FusionLog \ NativeImage \ Starter.exe \ directorio:

*** Assembly Binder Log Entry (6/4/2012 @ 1:56:13 PM) *** 

The operation failed. 
Bind result: hr = 0x80070002. The system cannot find the file specified. 

Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll 
Running under executable C:\Documents and Settings\Administrator\Desktop\tmp\k;k\Starter.exe 
--- A detailed error log follows. 

=== Pre-bind state information === 
LOG: User = MENKAUR-7683827\Administrator 
LOG: DisplayName = BookmarkWiz.Kernel, Version=1.0.4538.22813, Culture=neutral, PublicKeyToken=null 
(Fully-specified) 
LOG: Appbase = file:///C:/Documents and Settings/Administrator/Desktop/tmp/k;k/ 
LOG: Initial PrivatePath = NULL 
LOG: Dynamic Base = NULL 
LOG: Cache Base = NULL 
LOG: AppName = Starter.exe 
Calling assembly : Starter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. 
=== 
LOG: Start binding of native image X, Version=1.0.4538.22813, Culture=neutral, PublicKeyToken=null. 
WRN: No matching native image found. 
LOG: IL assembly loaded from C:\Documents and Settings\Administrator\Desktop\tmp\k;k\X.dll. 

no puedo firmar el montaje, ya que hace referencia a sí misma Veral otras asambleas, que no están firmados

+0

Consulte mi respuesta actualizada y compruebe si sus dlls están bloqueados porque provienen de una fuente no confiable. – flayn

+2

Suena como algo que debe investigar utilizando el Registro de Fusion - http://stackoverflow.com/questions/4562859/solving-assembly-not-found-filenotfoundexception-fusion-log –

+0

ver la actualización ..... –

Respuesta

11

... no podía cargar el archivo o ensamblado 'X' o una de sus dependencias ...

Lo más probable es que no se carga otra dependencia.

puede intentar comprobar las dependencias con un walker de dependencia.

es decir: http://www.dependencywalker.com/

revise su configuración de construcción (86/64)

Editar: También tuve este problema una vez cuando estaba copiando dlls en postal de un recurso compartido de red "no confiable". El archivo fue bloqueado por Windows y se generó FileNotFoundException.

Ver aquí: Detected DLLs that are from the internet and "blocked" by CASPOL

+10

Dependency walker only perfil de programas no administrados. –

1

que resuelven este problema cambiando el nombre de la DLL. La DLL había sido renombrada manualmente cuando se cargó en su ubicación compartida (se agregó un número de versión al nombre del archivo). La eliminación del número de versión del archivo descargado resolvió el problema.

0

Tuve el mismo problema. Para mí, ayudó a eliminar el directorio .vs en la carpeta del proyecto.

+0

Eso no ayudó en mi caso. – Shimmy

Cuestiones relacionadas