Added reference for windows service and changed AddCertificate to use it, which worked.