我需要使用批处理文件在GAC中注册程序集.有没有办法找到安装位置GacUtil.exe或有没有办法在没有GacUtil的情况下注册组件?
Ric*_*ich 25
GacUtil没有安装只有SDK安装的框架安装 - 所以你无法保证它将安装在你正在安装的盒子上.
这在批处理文件中不起作用,但如果您自己开发了应用程序,则可以使用下面描述的GacInstall方法:http:
//msdn.microsoft.com/en-us/library/system.enterpriseservices.internal.publish. gacinstall.aspx
或者,我建议生成一个msi文件来部署应用程序.教程:http:
//www.dreamincode.net/forums/topic/58021-deploying-ac%23-application-visual-studio-setup-project/
在您的发行版中包含GacUtil.exe的副本是一个不可取的解决方案,因为它是根据不同的许可证而您可能无权重新发布它
kam*_*eet 10
您可以通过执行以下操作将dll安装到GAC(全局程序集缓存)中
[Reflection.Assembly]::LoadWithPartialName("System.EnterpriseServices") | Out-Null
[System.EnterpriseServices.Internal.Publish] $publish = new-object System.EnterpriseServices.Internal.Publish
$publish.GacInstall(<<FullFilePathToTheDll>>)
Run Code Online (Sandbox Code Playgroud)
这与本机PowerShell有很少的作用,而是通过实例化和使用PowerShell中的.NET库
做一个iisreset.