I have a native VC++ project that uses a dll (which is not in a project). Now, I must to put the dll in one the ‘Search Path Used by Windows to Locate a DLL’ link
but I don’t want the dll to sit in the exectuable or current or windows or system directory.
So my only option according to that is adding the path to the %PATH% environment variable.
Is there any other way?
Is there an elegant way to do so (adding to PATH)? should I do this on installation? should I be concerned if i’m doing this?
Summing up all the techniques I have found:
string temp = ‘myFullDirectoryPathToDll’; string temp2 =Environment.GetEnvironmentVariable(‘PATH’) + ‘;’ + temp; Environment.SetEnvironmentVariable(‘PATH’, temp2);
this, and I think MSDN should have stressed that, changes the environment variable PATH only in this process.
when debugging in VS the appPath doesn’t ‘work’ use properties->debug->environment and merge environment variables link