Show/Hide Toolbars

Flynet SharePoint Host Access Web Part

Navigation: What You Can Do > Visual Studio Activities

Packaging a WSP for the Web Part

Scroll Prev Top Next More

If the deploy worked for you in the last section, you can skip this, but remember it exists because you never know when deploy will not be available directly from VS...

 

If you use the Package option (right-click on Web Part project and select Package), a standard WSP file will be created.  Using whatever method is available to you, network share copy, FTP or whatever, get the WSP file to your target SharePoint server.

 

While an improved PS1 file with templated values should be produced automatically as part of your generation, in this version please copy the following to a new PS1 file (PowerShell Script), naming it based on your project name.

 

If you are a Powershell scripter, feel free to convert the strings "FlynetTerm" and "http://wt-sp2010" to parameters or variables and set them to match your web part name and server.  Otherwise, the quick & dirty approach would be use search-and-replace.  There is also a hard-coded path to the WSP file (e:\flynet\installers) that will need to be updated.

 

Once you have a PS1 script, you can run it in the SharePoint admin powershell...

 

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.."

    }

}

 

Write-Host 'Disable feature...'

Disable-SPFeature -Identity FlynetTerm_Feature1 -confirm:$false -url http://wt-sp2010

Write-Host 'Uninstall feature...'

Uninstall-SPFeature -Identity FlynetTerm_Feature1 -confirm:$false -force

Write-Host 'Uninstall Solution...'

UnInstall-SPSolution -Identity FlynetTerm.wsp -allwebapplications -confirm:$false

Write-Host 'Waiting for Uninstall to Finish...'

WaitForJobToFinish

Write-Host 'Remove Solution...'

Remove-SPSolution -Identity FlynetTerm.wsp -confirm:$false

Write-Host 'Add Solution...'

Add-SPSolution e:\flynet\installers\FlynetTerm.wsp

Write-Host 'Install Solution...'

Install-SPSolution -Identity FlynetTerm.wsp -WebApplication http://wt-sp2010 -GACDeployment

Write-Host 'Waiting for Install to Finish...'

WaitForJobToFinish

Write-Host 'Activate Feature...'

Enable-SPFeature -Identity FlynetTerm_Feature1 -confirm:$false -url http://wt-sp2010