project runs fine in visual studio, but not as a standalone exe. Why?

H

HONOREDANCESTOR

I have a vb 'solution' which has 2 projects, one of which produces an
exe, and one of which produces a dll. (The exe uses the dll). When I
click on Debug/Start-without-debugging, it works well. But if I close
Visual Studio, and then double click on the 'exe', I get into
trouble. An error message comes up saying:
"System.IO.FileNotFoundException: Could not load file or assembly
'clslib' or one of its dependencies."
It sounds like either the exe cannot locate the dll, or the dll itself
cannot locate some of its dependencies (it depends on several dlls I
got from a developer).
But I'm not sure what I should do about this. Should I make a new
directory, and copy the exe, the dll, and all dependent dlls to that
directory? And why does it work when run from within Visual Studio?
Thanks,
HA
 
Z

zacks

I have a vb 'solution' which has 2 projects, one of which produces an
exe, and one of which produces a dll. (The exe uses the dll). When I
click on Debug/Start-without-debugging, it works well. But if I close
Visual Studio, and then double click on the 'exe', I get into
trouble. An error message comes up saying:
"System.IO.FileNotFoundException: Could not load file or assembly
'clslib' or one of its dependencies."
It sounds like either the exe cannot locate the dll, or the dll itself
cannot locate some of its dependencies (it depends on several dlls I
got from a developer).
But I'm not sure what I should do about this. Should I make a new
directory, and copy the exe, the dll, and all dependent dlls to that
directory? And why does it work when run from within Visual Studio?
Thanks,
HA

I would generate EXE with a setup project. As long as the EXE project
is configured to "depend" on the DLL project, you should be good to
go.
 
C

Chris Dunaway

I have a vb 'solution' which has 2 projects, one of which produces an
exe, and one of which produces a dll. (The exe uses the dll). When I
click on Debug/Start-without-debugging, it works well. But if I close
Visual Studio, and then double click on the 'exe', I get into
trouble. An error message comes up saying:
"System.IO.FileNotFoundException: Could not load file or assembly
'clslib' or one of its dependencies."
It sounds like either the exe cannot locate the dll, or the dll itself
cannot locate some of its dependencies (it depends on several dlls I
got from a developer).
But I'm not sure what I should do about this. Should I make a new
directory, and copy the exe, the dll, and all dependent dlls to that
directory? And why does it work when run from within Visual Studio?
Thanks,
HA

Is the .dll located in the same folder as the .exe?

Chris
 
H

HONOREDANCESTOR

Is the .dll located in the same folder as the .exe?

Chris

That was it! I had to copy the dll and the exe, and all the secondary
dlls that the dll depends on, to one folder. Then I double clicked on
the exe, and it found the dlls.
Thanks,
HA
 

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