Why does the WPF designer fail to load libraries that call into unmanaged DLLs?
Because the Visual Studio designer copies your assemblies to a temporary location, but doesn't copy your unmanaged dependencies, you can run into this problem.
The simplest solution, although not ideal, is to add a folder that contains your unmanaged dependencies to the PATH
environment variable, and then start DevEnv.exe
with that PATH
.
You can do this either by:
- Adding the folder to the System environment variables using Computer -> Properties
- Using a batch file that sets the path and then starts DevEnv
The problem with this solution is that as the unmanaged dependencies are rebuilt Visual Studio tends to "hang onto" them or not use the new ones and so you end up needing to exit and restart Visual Studio after using the designer to properly totally rebuild everything and this can be a bit of a pain.