Sometimes you might get a same class appeared in your solution twice!!! Then build would fail consequently.
The solution is:

  • Unload the complaining feature
  • Edit the project file and find the duplicated class and remove one of the references

Run the build again and it should be fixed.