I cannot count the number of times I have pointed out that the Copy Local flag should be set to false on the Revit API assembly references. Here are some of the numerous previous examples and explanations of this:
This flag appears in the properties of the Revit API references. It is also displayed in the list of the references themselves in a VB project. Here they are set to True, which is what we want to avoid:
In a C# project, you can right click on the Revit API references in the Visual Studio solution explorer and selecting its properties in the context menu to see and modify its current setting:
You can toggle this property with a double click.
If this flag is set to True, Visual Studio will create local copies of RevitAPI.dll and RevitAPIUI.dll when compiling the plug-in and use these copies when loading them. This confuses the debugger and Revit when running the add-in, as well as unnecessarily polluting your hard disk with copies of this multi-MB file.
To avoid having to reset this property when modifying an existing reference, for instance when migrating to a new version of the Revit API, do not delete the existing reference. Instead, simply add the new reference to the current assembly to overwrite the old one. The old, existing data will be updated, the new path will be stored, and the existing 'Copy Local' setting will be preserved.
By the way, the same applies to the AutoCAD.NET assemblies.
At least this post gives me a completely comprehensive description to refer to next time I have to point this out...