In my case, the issue seemed to be that there was already a project reference to the same assembly. The package reference got added successfully once I removed the project reference.