jle*_*bke 4 powershell ssis gac .net-4.0
我正在使用.ps1脚本在生产Win 2008服务器r2上向GAC注册一组.NET 4.0程序集.程序集具有强名称,脚本不返回任何错误:
[Reflection.Assembly]::LoadWithPartialName("System.EnterpriseServices");
[System.EnterpriseServices.Internal.Publish] $publish = New-Object System.EnterpriseServices.Internal.Publish;
$publish.GacInstall("D:\MyComponents\EZTrac.Domain.Dealer.dll")
Run Code Online (Sandbox Code Playgroud)
在我运行之后,我查看GAC_MSIL(它应该在哪里),然后是GAC_32和GAC_64以获得良好的衡量标准,但它不在任何这些中.
我用这篇文章作为指南.知道我忘记了什么吗?
这是我为gaccing程序集编写的一个小函数函数.在执行此操作之前,它会进行一些检查:
function Gac-Util
{
param (
[parameter(Mandatory = $true)][string] $assembly
)
try
{
$Error.Clear()
[Reflection.Assembly]::LoadWithPartialName("System.EnterpriseServices") | Out-Null
[System.EnterpriseServices.Internal.Publish] $publish = New-Object System.EnterpriseServices.Internal.Publish
if (!(Test-Path $assembly -type Leaf) )
{ throw "The assembly $assembly does not exist" }
if ([System.Reflection.Assembly]::LoadFile($assembly).GetName().GetPublicKey().Length -eq 0 )
{ throw "The assembly $assembly must be strongly signed" }
$publish.GacInstall($assembly)
Write-Host "`t`t$($MyInvocation.InvocationName): Assembly $assembly gacced"
}
catch
{
Write-Host "`t`t$($MyInvocation.InvocationName): $_"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4067 次 |
| 最近记录: |