That System.IO.FileNotFoundException again ...

  • Thread starter Thread starter Gerhard Menzl
  • Start date Start date
G

Gerhard Menzl

This must be one of the most frequently asked questions related to the
..NET framework, yet there seems to be no authoritative answer.

I have created a C++ .NET application that references three assemblies
other than the framework assemblies: a C++ assembly written by myself, a
C# assembly, and an RCW Interop assembly automatically generated by
Visual Studio. The reference tree looks like this:

C++ EXE
|
----------------------------
| | |
C++ DLL C# DLL RCW Interop DLL

On my development machine, everything works like a breeze. Well, sort
of. But when copying the four assemblies to another machine (all into
the same directory), starting the application raises the dreaded
System.IO.FileNotFoundException exception in wWinMain. The message text is

"File or assembly name <name of my C++ DLL>, or one of its
dependencies, was not found."

I have searched both the Web and Usenet extensively, and the causes
stated most often just don't seem to apply:

1. GAC

The C++ DLL (the one the framework complains it cannot find although it
is in the same directory) used to be a strong-named assembly. Adding it
to the GAC was of no avail, and so was removing the strong name.

2. Permissions

Everyone has full control in the application directory.

3. COM Interop

The COM server referenced by the Interop assembly has been installed
properly.

This problem seems to plague hundreds of people, yet I have not been
able to find a comprehensive overview of the possible causes. XCOPY
deployment? Come on!

Ideas anyone?
 
or one of its
dependencies, was not found."

Take care of the dependencies of your C++ DLL, probably one or more are
missing on the target machine.

Willy.
 
Willy said:
or one of its
dependencies, was not found."

Take care of the dependencies of your C++ DLL, probably one or more are
missing on the target machine.

The References section in the solution explorer lists these dependencies:

System.XML
System.Windows.Forms
System.Drawing
System.Data
System
mscorlib

As far as I know, all of these should be installed with the .NET framework.

If it is a dependency of my DLL that is missing and not the DLL itself,
why does the framework not name it? Judging from the multitude of
newsgroup postings, this is a problem which plagues hundreds of people.
In my view, this is a deplorable step back behind Win32, which was quite
capable of stating what exactly is missing.
 
Back
Top