hnetcfg.dll throws BadImageFormatException
问题 Executing code that references c:\windows\system32\hnetcfg.dll to manage the Windows Firewall from this question, causes a BadImageFormatException as soon as the DLL is loaded. Opening the 414KB DLL file in NUnit for inspection throws the same exception. I am running Windows 7. Any solutions? 回答1: Solved: ...by setting target platform to x86. 回答2: Is it a 64-bit application trying to reference a 32-bit dll? If so, either get the 64-bit version of the dll or force the application to run in 32