How to resolve this FileNotFoundException?!

K

K Viltersten

I'm getting this message.

System.IO.FileNotFoundException was unhandled
Message: It's not possible to load the file or
assembly SomeName, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null or one of
its dependencies. The file can not be found.

When i run the file from where it's compiled
to, it works. If i run the file from elsewhere,
i end up getting this error.

The above and the fact that i don't refer to
SomeName from the source code, makes me guess
that it's because i'm using it as a reference.

Now, how can i resolve this problem?

I'm a logic and class structure designer so
the actual deployment is sometimes awkwardly
incomprehensable to me. Please be gentle... :)
 
S

sloan

Most times I get something like that...it means I'm referencing a file
MySuperCoolAssembly.dll

but, somewhere along the chain, there are 2 versions of
MySuperCoolAssembly.dll

and during project build, one project is overwriting the other.

To try and resolve it:

Put MySuperCoolAssembly.dll somewhere (new)
c:\newfolder\MySuperCoolAssembly.dll

Go through your projects.

I would go through my solution, find all refs to MySuperCoolAssembly.dll,
and then remove the ref, and then add it back in from
c:\newfolder\MySuperCoolAssembly.dll

Rebuild, try again.

If it works, then you work your way back out of it,....
remove the reference to
c:\newfolder\MySuperCoolAssembly.dll
and then rereference from its orginal location.
Eventually, one will break.

If you rebuild and it still craps...then you have some more dectective work
to find where the (different version) of MySuperCoolAssembly.dll is coming
from.

I think that's is what is happening.


..............
 
D

DaveL

If the dll in question is not a common dll
you need to place the dll with your Applicaion folder or sub folders

If this is a common dll , whereas lots of other applications
require it, check out placing it in the Gac

Dave
 
K

K Viltersten

I'm not sure. Where in reference should it be?
The folder with my references only shows the
packages/files i've chosen to use...

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
"Alhambra Eidos Desarrollo"
 
C

Ciaran O''Donnell

Select the Assembly in the references folder in the project and then open the
properties window. There is a property called CopyLocal which should be true.
VS will then automatically put a copy of the dll in the project bin folder.
 
K

K Viltersten

Select the Assembly in the references folder in the project and then open
the
properties window. There is a property called CopyLocal which should be
true.
VS will then automatically put a copy of the dll in the project bin
folder.

Oh, now i see. It does so already. The problem is that i then
move the files by hand to another directory. That's the
problem. I assumed that the compiler automagically baked
in all the DLL's and EXE's needed into one and the same
file that i could then run from anywhere. Stupid me...

Thousand thanks to everybody.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top