Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
461 views
in Technique[技术] by (71.8m points)

Drag and drop a DLL to the GAC ("assembly") in windows server 2008 .net 4.0

I've trying to deploy some code to a client machine, where I don't want to install MS windows SDK tools. This means don't have access to "gacutil". I also have not created an installer for my code. It seems that these might be the only two options in .net 4.0.

In the past I would simply go to start, run, type "assembly", and drag and drop my dll in.

Is this no longer possible? When I try to do this I get no error message, but the dll doesn't appear in the "assembly" folder. When I use gacutil on my dev machine it works properly, but the dll still doesn't appear.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In .net 4.0 Microsoft removed the ability to add DLLs to the Assembly simply by dragging and dropping.

Instead you need to use gacutil.exe, or create an installer to do it. Microsoft actually doesn’t recommend using gacutil, but I went that route anyway.

To use gacutil on a development machine go to:
Start -> programs -> Microsoft Visual studio 2010 -> Visual Studio Tools -> Visual Studio Command Prompt (2010)

Then use these commands to uninstall and Reinstall respectively. Note I did NOT include .dll in the uninstall command.
gacutil /u myDLL
gacutil /i "C:Program FilesCustommyDLL.dll"

To use Gacutil on a non-development machine you will have to copy the executable and config file from your dev machine to the production machine. It looks like there are a few different versions of Gacutil. The one that worked for me, I found here:
C:Program Files (x86)Microsoft SDKsWindowsv7.0ABinNETFX 4.0 Toolsgacutil.exe C:Program Files (x86)Microsoft SDKsWindowsv7.0ABinNETFX 4.0 Toolsgacutil.exe.config

Copy the files here or to the appropriate .net folder;
C:WindowsMicrosoft.NETFrameworkv4.0.30319

Then use these commands to uninstall and reinstall respectively
"C:UsersBHJeremyDesktopInstalling to the Gac in .net 4.0gacutil.exe" /u "myDLL"

"C:WindowsMicrosoft.NETFrameworkv4.0.30319gacutil.exe" /i "C:Program FilesCustommyDLL.dll"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...