Set Copy Local to False

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:
<!–
006_sdk_samples_solution.htm:'Copy Local' flag maintained by
006_sdk_samples_solution.htm:and at the same time the existi
008_debugging.htm:

  • Do not forget to set the ‘Copy Local’
    008_debugging.htm:

  • Do not forget to set the ‘Copy Local’
    024_application_events_vb.htm:

  • Set its ‘Copy Local’ flag
    159_export_instance_to_gbxml.htm:

  • Set Copy L
    159_export_instance_to_gbxml.htm:

    <

    h4>Set Copy Local to False
    159_export_instance_to_gbxml.htm:

    Always ensure that the C
    189_porting_to_vb.htm:

  • Click the “Show All Files” button
    268_custom_ribbon_tab.htm:As always, we need to remember to
    310_reload_addin.htm:

    By the way, in this sample, the Revi
    360_p2c.htm:

    Almost all Revit add-ins will need to referen
    415_devtv_addin_templates.htm:

  • References to Revit assemb
    443_idling_selection_watcher.htm:

  • You need to set the ‘Co
    459_cpp_addin.htm:

    Don’t forget to set the Copy Local flag
    –>

    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:

    Copy Local flag in a VB project

    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:

    Copy Local flag in a C# project

    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…


  • Comments

    One response to “Set Copy Local to False”

    1. I am trying this with AutoCAD 2011 and Visual C# Express 2008 in Win 7 64-bit and it does not work! I must have Copy Local = True or I get an error about loading the acmgd.dll. I do NOT have the AutoCAD .NET wizard installed. Suggestions, comments?

    Leave a Reply

    Discover more from Autodesk Developer Blog

    Subscribe now to keep reading and get access to the full archive.

    Continue reading