您必须撤回解决方案,重新启动计时器,再次部署。确保 dll 来自相同的解决方案。
修改此行:
$solutionName=" yousolution.wsp "
$SolutionPath="* H:* "+$solutionName
试试这个 power shell 脚本:
function WaitForJobToFinish([string]$SolutionFileName)
{
$JobName = "*solution-deployment*$SolutionFileName*"
$job = Get-SPTimerJob | ?{ $_.Name -like $JobName }
if ($job -eq $null)
{
Write-Host 'Timer job not found'
}
else
{
$JobFullName = $job.Name
Write-Host -NoNewLine "Waiting to finish job $JobFullName"
while ((Get-SPTimerJob $JobFullName) -ne $null)
{
Write-Host -NoNewLine .
Start-Sleep -Seconds 2
}
Write-Host "Finished waiting for job.."
}
}
Add-PsSnapin Microsoft.SharePoint.PowerShell
$CurrentDir=$args[0]
$solutionName="yousolution.wsp"
#$SolutionPath=$CurrentDir + "\"+$solutionName
$SolutionPath="H:\"+$solutionName
Write-Host 'Going to uninstall solution'
Uninstall-SPSolution -identity $solutionName -allwebapplications -confirm:$false
Write-Host 'Waiting for job to finish'
WaitForJobToFinish
Write-Host 'Going to remove solution'
Remove-SPSolution -identity $solutionName -confirm:$false
Write-Host 'Restarting OWS Timer jobs'
$farm = Get-SPFarm
$farm.TimerService.Instances | foreach {$_.Stop();$_.Start();}
$farm = Get-SPFarm
$farm.TimerService.Instances | foreach {$_.Stop();$_.Start();}
$farm = Get-SPFarm
$farm.TimerService.Instances | foreach {$_.Stop();$_.Start();}
$farm = Get-SPFarm
$farm.TimerService.Instances | foreach {$_.Stop();$_.Start();}
Write-Host 'Going to add solution'
Add-SPSolution $SolutionPath
Write-Host 'Going to install solution to all web applications'
Install-SPSolution -identity $solutionName -allwebapplications –GACDeployment -Force
Write-Host 'Waiting for job to finish'
WaitForJobToFinish
Remove-PsSnapin Microsoft.SharePoint.PowerShell
在此处找到您的 dll:C:\Windows\assembly 并比较其是否已更新。