Reputation: 535
I need to use DHCP server management API in my C#.net application. My target platform is Windows Server 2008 R2 (64 bit obvious I guess). I am getting this error "A reference to 'dhcpsapi.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
Assuming it is a COM dll I even tried TLB export but with error TlbExp : error TX0000 : Could not load file or assembly 'dhcpsapi.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
I found this assembly in C:\Windows\System32 folder. I have also tried starting VS in "Run as Admin" mode. Any help, highly appreciated.
Upvotes: 1
Views: 1950
Reputation: 13932
dhcpsapi.dll isn't a COM dll. It's a plain DLL, and you'll need to use P/Invoke to call functions in it. PInvoke.Net is a good place to look for prewritten P/Invoke calls.
Upvotes: 2