Epic Blog of Awesome

code.tech.sci.math.art.write

>Windows 7 workaround to drag & drop DLLs to GAC – CodeProject

>

Introduction

I develop in Visual Studio, and I’m switching from XP on my workstation to Window 7 x64. One thing that annoyed me was that I can’t simply drag .NET library DLLs to the assembly folder to install them in the GAC, or select and delete them from the assembly folder to remove them from the GAC, as I had done on Windows XP. When I try to, I get an ‘access denied’ error, even though my domain login is in the Administrators group, and even though I start Windows Explorer with ‘Run as administrator’.

Apparently, Microsoft really wants you to create installation applets to install or remove libraries in the GAC. An alternative is to log on as the actual machine administrator, in which case, drag and drop to the GAC will work.

I like being able to easily add or delete libraries to the GAC on a development workstation, however, so I came up with a work-around to let me do this.

Background

The method is to create .bat command files that use gacutil.exe to add or delete the library, to capture the name of the library when the library file is dragged to the command file, and have the command file run as administrator. Windows 7 doesn’t allow you to set a .bat command file to run as administrator, so a shortcut is created for each command file, and the shortcut is set to run as administrator.

Posted via email from Mocha Brain Freeze

Category: Developing

Your email address will not be published. Required fields are marked *

*