.net 我可以在不安装 VS 或 SDK 的情况下下载并安装 gacutil.exe 吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5572516/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 15:27:07  来源:igfitidea点击:

Can I download and install gacutil.exe without having to install VS or the SDK?

.netdownloadinstallgacgacutil

提问by richard

I want an administrator to register some DLLs for me, but he would probably prefer not to install the whole SDK.

我希望管理员为我注册一些 DLL,但他可能不想安装整个 SDK。

Can he just install gacutil.exe? If so, where can he get it? Do I just email the gacutil.exefile to him, and where does he have to put it on his machine to use it?

他可以安装gacutil.exe吗?如果是这样,他从哪里得到它?我是否只是将gacutil.exe文件通过电子邮件发送给他,他必须将它放在他的机器上的哪个位置才能使用它?

采纳答案by richard

Per Hans' comment on my question, it's against the license. The best thing to do here is to create a quick setup.exe or msi which will install the files into the GAC, which I have done.

根据汉斯对我的问题的评论,这是违反许可证的。这里最好的办法是创建一个快速 setup.exe 或 msi,它将把文件安装到 GAC 中,我已经完成了。

回答by BigBob

I got it working by copying gacutil.exe, gacutil.exe.configand gacutlrc.dll. I understand it's against the licence, but you can't get InstallShield in VisualStudio Express so this was the simplest solution.

我通过复制gacutil.exegacutil.exe.configgacutlrc.dll使其工作。我知道这违反了许可证,但是您无法在 VisualStudio Express 中获得 InstallShield,因此这是最简单的解决方案。

回答by Dan Field

Old question, but in a pinch on a machine that doesn't have the SDK installed, as long as PowerShell is available you can do this:

老问题,但在没有安装 SDK 的机器上紧要关头,只要 PowerShell 可用,您就可以执行以下操作:

#Note that you should be running PowerShell as an Administrator
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")            
$publish = New-Object System.EnterpriseServices.Internal.Publish            
$publish.GacInstall("C:\Path\To\DLL.dll")

From https://www.andrewcbancroft.com/2015/12/16/using-powershell-to-install-a-dll-into-the-gac/

来自https://www.andrewcbancroft.com/2015/12/16/using-powershell-to-install-a-dll-into-the-gac/

回答by jeffreypriebe

Also an alternative is to just manually drag and drop the DLL into c:\windows\assembly.

另一种替代方法是手动将 DLL 拖放到 c:\windows\assembly 中。

For .net 4, I believe the assembly folder is c:\windows\microsoft.net\assembly - though I haven't tested a simple xcopy addition in this manner on .net 4.

对于 .net 4,我相信程序集文件夹是 c:\windows\microsoft.net\assembly - 尽管我没有在 .net 4 上以这种方式测试过简单的 xcopy 添加。