.NET Reference “Copy Local” True / False Being Set Based on Contents of GAC

前端 未结 5 1114
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-06 05:08

We had a very interesting problem with a Win Forms project. It\'s been resolved. We know what happened, but we want to understand why it happened. This may help other people

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-06 05:42

    At run time, assemblies must be in one of two locations: the output path of the project or the global assembly cache (see Working with Assemblies and the Global Assembly Cache). If the project contains a reference to an object that is not in one of these locations, then when the project is built, the reference must be copied to the output path of the project. The CopyLocal property indicates whether this copy needs to be made. If the value is true, the reference is copied. If false, the reference is not copied.

    The project-assigned value of CopyLocal is determined in the following order:

    1. If the reference is another project, called a project-to-project reference, then the value is true.
    2. If the assembly is found in the global assembly cache, the value is false.
    3. As a special case, the value for the mscorlib.dll reference is false.
    4. If the assembly is found in the Framework SDK folder, then the value is false. Otherwise, the value is true.

    Regards... Muse VSExtensions

提交回复
热议问题