hi,
I am using a dll.i want to call the dll statically,means i have used like this
[DllImport("Connector.dll")]
public static extern void iaxc_set_preferred_source_udp_port(int udpPort);
Even though it is not working properly,when i run the application,it is checking whether the dll is existing in application folder.but i dont want to put the dll in application folder.Even i tried to hide it.But it is not possible?Is there any way to do call dll statically?
Loading
ido shaharPosted Jun 6, 2009, 1:16 PM
Create Strong Assembly Name
1) Create new snk file in the .net framework drive.
How?
open Visual Studio 2005 Command Prompt (%comspec% /k ""C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"" x86)
and then write there: "sn -k filename.snk"
2) Compile the DLL with the snk file.
a. copy near the DLL file.
b. Add attribute via the Properties.(at the Assemblies Properties write:
[assembly: AssemblyKeyFileAttribute(@"..\\..\\filename.snk")]
3) Compile the DLL by dragging it to the GAC. (C:\WINDOWS\assembly)
4) For using the DLL:
a. Reference from the project to the DLL.
b. change the property "Copy local – true" to "false".
and now the dll locate at the GAC (Global Assembly Cache) as assembly, so the EXE file may be stand alone in every folder.