If you have problems with ICD, such as error messages that prevent you entering the debugger, please check the Project settings first.
Project -> Edit Project
Set the programming lines to PGEC2 and PGED2 (or PGC2/PGD2, depending on the designator)
You can find this in the Project settings under various definitions, depending on the MCU you are using.
For example, ICD Communication Channel, Comm Channel Select, ICE/ICD Comm Channel Select, etc.