using namespace System::Runtime::InteropServices;

	[DllImport("C:\\Program Files (x86)\\VideoLAN\\VLC\\libvlc.dll")]

Note the string is a constant defined at compile time.
The default search order will start looking in the directory from which your application was loaded. If you place a DLL there during the install, it will be found.
The locations specified in the system PATH variable will also be checked.
You can use the SetDllDirectory function to specify a single location for dllimport to check, or you need to add locations to the system PATH variable for multiple locations.


	public ref class MyClass
		[DllImport("kernel32.dll", CharSet = CharSet::Auto, SetLastError = true)]
		static bool SetDllDirectory(String ^lpPathName);

	MyClass::SetDllDirectory(Environment::GetFolderPath(Environment::SpecialFolder::ProgramFiles) + "\\VideoLAN\\VLC\\");

Add dll File As A Reference To Your Project Instead

Add the dll file to the main project directory.

Right Click Project > Common Properties > Framework and References > Add new reference > Browse > [select your dll file]

Now you can use it without importing:

using namespace MyDllName;


We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published.