In my situation, I have two separate projects under the solution. The problem was that these projects were targeting different CPU architectures. You can fix this by changing your projects to target the same CPU architecture.