Can't load file with command line csc build

A

andrew.bell.ia

Hi,

I am building my application with the csc compiler from the command
line. I am linking in a dll (GuiUtils.dll) which is not in the current
directory. The command line looks like:

csc /referece:c:/foo/bar/GuiUtils.dll *.cs

When I go to run the program, I get an error like:

Unhandled Exception: System.IO.FileNotFoundException: File or assembly
name 'Gui
Utils, Version=1.0.1895.18096, Culture=neutral, PublicKeyToken=null',
or one of
its dependencies, was not found.
File name: 'GuiUtils, Version=1.0.1895.18096, Culture=neutral,
PublicKeyToken=nu
ll' ---> System.IO.FileNotFoundException: The system cannot find the
file specif
ied.
at NRI.Scan.MainForm.Main()

Can someone please explain what I am missing when I build that causes
this problem? Does the dll get sucked into the .exe? If not, can it
be? Is it somethinge else?

Thanks,

-- Andrew Bell
(e-mail address removed)
 
M

Morten Wennevik

Hi Andrew,

I'm guessing GuiUtils.dll is using quite a few other namespaces and you
need to reference all of them, like System.Windows.Forms.dll etc
 
A

andrew.bell.ia

Thanks for your thoughts Morton.

If they were missing, wouldn't things fail at compile time? I thought
all the system DLLs were included unless you specifically asked for
them to be excluded.

-- Andrew Bell
(e-mail address removed)
 
A

andrew.bell.ia

OK, if I copy the DLL into the directory containing the .exe, it works.
Is there any way that I can either

- static link in the UNIX sense (include the DLL into the executable so
that the DLL doesn't have to be available at runtime)

OR

- set the search path for the DLL INTO the executable so that at
runtime the search path is appropriately augmented.

Any pointers, or pointers to documentation, are much appreciated.

-- Andrew Bell
(e-mail address removed)
 
A

andrew.bell.ia

Sorry for the bother. I didn't realize that there was something new
called "Fusion" which manages these things differently. Once you know
what to look for...

-- Andrew Bell
(e-mail address removed)
 
M

Morten Wennevik

Ah, sorry, I tought it was at compile time, and the system dlls do indeed
appear to be added by default.
 

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