The error seems to go away when I configured the project to target the same platform (targeted all to x64 and published as x64).
Step 6 in this article.