I am trying to make a simple
c# program using
Growl C# API.
I tried to compile my program in two different ways:
I kept my
.dllfile in the same directory as my
.csfile. Than I ran
csc /r:Growl.Connector.dll,Growl.CoreLibrary.dll /out:test.exe *.cs
It compiled fine and also ran fine.
Now I have created a directory inside my current working directory named
growland kept all my
Now when I try to compile it using the below command
csc /r:"D:\Modified\Growl_NET_Connector_SDK\libraries\growl\Growl.Connector.dll","D: \Modified\Growl_NET_Connector_SDK\libraries\growl\Growl.CoreLibrary.dll" /out:test.exe *.cs
It compiled fine but when I tried to run it the below mentioned exception occurred.
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Growl.Connector, Version=184.108.40.206, Culture=n eutral, PublicKeyToken=980c2339411be384' or one of its dependencies. The system cannot find the file specified. at GrowlNotification.Program.Main(String args)
So, my question is what is the correct way to reference
.dll file in
csc when files are in an external folder.
Here is the directory structure for 2nd case.
So, my question is what is the correct way to reference .dll file in csc when files are in an external folder.
You’re already referencing them at build time. You just need to make them available at execution time too, but copying them into the same directory as the executable, when you want to run it.
You could also investigate using the Global Assembly Cache if these are signed assemblies, but personally I’d stick with just keeping the executable with the libraries on which it depends.
Answered By – Jon Skeet