This may be a stupid question but...
'target device does not match selected device'
Do you have the corect chip selected any and every place it can be selected, (IDE,Compiler, Programmer ) ?