What's the 'correct' way of registering/installing an Assembly to the GAC?

前端 未结 8 840
独厮守ぢ
独厮守ぢ 2020-12-01 16:23

There seems to be lots of different ways to register assemblies with the GAC, as in, they \'work\'. However, what\'s the \"proper\" way of doing it?

In response to

8条回答
  •  心在旅途
    2020-12-01 17:15

    copy directly to %WINDIR%\Assembly.

    Advantage: Straightforward.

    Disadvantage: AFAIK, %WINDIR%\Assembly just happens to be where it is right now, and it's location is subject to change. This would make it break in future versions of windows or if that folder's behavior chaneges. This probably isn't the right way.

    Extreme Disadvantage: As said by madmath:

    just copying your assembly into c:\windows\assembly won't work. Explorer only shows a simplified view of the folder, which contains in fact lots of different folders for different kinds of assemblies. Doing a copy in it from an installer won't trigger all the operations done by explorer on a drag-and-drop. (written here because I don't have enough reputation yet to comment on other posts).

提交回复
热议问题