Check if you are missing any using directives or package references in the deployment environment. That should fix the issue. I had a similar issue, and after thoroughly checking the code, I found that I was missing some using directives.