Wednesday, May 29, 2013

View the GAC like a normal File/Folder and Copy/Paste From/To the GAC


היי חברים,
החבר'ה מצוות הפיתוח ביקשו שאפרוש להם קבצי DLL ו- PDB באחד האתרים ב-SP בעקבות שינויים שביצעו בקוד.
רציתי לפרוש את הקבצים ב-GAC אבל כמו שאנחנו יודעים ספריית ה- Assembly תחת C:\Windows  איננה נראית כמו ספריית קבצים רגילה ומעבר לכך כאשר אנחנו גוררים וזורקים את הקבצים לספרייה C:\windows\assembly   , הקבצים לא באמת ומעתקים לשם, ישנו פלאגין מיוחד שנקרא gacutil שמתקין את ה- assembly לתוך ה-GAC. הפלאגין הזה יכול להיות מבלבל משום שהוא עשוי לתת לנו אשליה שה-GAC  הוא פשוט תיקייה עם המון קבצי  DLL.
למעשה, זה מבנה היררכי עם תיקייה לכל assembly name, בתוכה יש תיקיות עבור גירסאות שונות, וכן הלאה.

כדי להגיע למקום הנכון ולהחליף את הקבצים איפשרתי Look & Feel של ספריית קבצים רגילה.
 אז איך עושים את זה :

לחץ על Start > Run ורשום Regedit. לאחר מכן נווט למיקום הבא :





HKEY_LOCAL_MACHINE ==> SOFTWARE ==> Microsoft ==> Fusion




צור ערך חדש מסוג DWORD וקרא לו DisableCacheViewer , לחץ על הערך פעמיים והכנס את הערך 1 בשדה Value Data. לחץ על OK וצא מהחלון.





פתח את תיקיית ה- Assembly וראה עכשיו את ה-DLL בתצורה רגילה של ספריית קבצים.

חשוב : פעולה זו תשבית את הפלאגין שמציג את ה- GAC כל כך פשוט (אבל זה גם יהפוך את הגרירה ושחרור לא שמישים - תצטרכו להפעיל את gacutil בעצמכם). כמובן שאתם יכולים להשתמש במנהלי קבצים חלופיים או קונסולה, אם אתם לא רוצים להתעסק עם הגדרות ב-Registry.


============================================================================================================================================================================================


Hi Everybody,

The guys From R&D asked me to put in the GAC DLLs and PDB of one of the sites in SP due to changes they carried out in the code.

When you drag and drop your assembly into C:\windows\assembly folder, it doesn't really get copied there—a special Windows Explorer plugin callis gacutil to install your assembly into GAC.
This Explorer plugin can be confusing because it may give one an illusion that GAC is just plain simple folder with lots of DLLs. Actually, it is a hierarchical structure with a folder for each assembly name, inside of which there are folders for different versions, and so on.

If you want to see the real GAC structure, open registry (Start ==> Run ==> regedit).


Go to HKEY_LOCAL_MACHINE ==> SOFTWARE ==> Microsoft ==> Fusion.


Set New DWORD Named DisableCacheViewer and write 1 in the value field





Important : This will disable Cache Viewer plugin that makes GAC look so simple (but it also will make drag and drop to install unusable—you'll have to call gacutil yourself). Of course, you can use alternative file managers or console as well, if you don't want to mess with registry settings.



No comments:

Post a Comment