I've added an unamanaged dll in project OldTesters using Add Existing File. I've also set BuildAction = Content and Copy to Output Directory = Copy if newer. I'm using some functions from unmanaged dll in OldTesters project via [DllImport("unamanged.dll")]
OldTesters is .NET project that I've referenced in my main project using Add Reference.
The problem is when I rebuild application everything works fine, but then I close app, and then click on start, it throws me DllNotFoundException
Unable to load DLL 'unmanaged.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
I've noticed that Visual Studio deleted unmanaged.dll from bin directory.
If I rebuild OldTesters project then it will work. But it is annoying always to rebuild OldTesters, cause I do not add any changes in that project. To prove that, if I click on Build, I will get:
========== Build: 0 succeeded, 0 failed, 6 up-to-date, 0 skipped ==========
because there are no changes in the project.When I run the app I get the same exception.