I have a SharePoint 2016 on-premise environment with wsp file with server side code. i want to deploy this pacakage into sharepoint online, is it possible please advise.

2 Answers 2


No, it isn't possible to deploy server side code to SharePoint Online. SharePoint Online is a software-as-a-service (SaaS) product.

You can however build client side customisations for SharePoint Online using SPFx or your own application that integrates with SharePoint Online. Additionally, there are Microsoft 365 applications like Power Apps and Power Automate that can utilise SharePoint Online.


You can deploy with powershell script. Please refer to the following code

#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"
Function Deploy-SPOSolution()
        [Parameter(Mandatory=$true)] [string] $SiteURL,
        [Parameter(Mandatory=$true)] [string] $WSPFilePath,
        [Parameter(Mandatory=$False)] [Int] $MajorVersion = 1,
        [Parameter(Mandatory=$False)] [Int] $MinorVersion = 0
    Try {
        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)  
        #Get the Solution Gallery
        Write-Host -f Yellow "Uploading WSP File to Solution Gallery..."
        $SolutionGallery =  $Ctx.Web.Lists.GetByTitle("Solution Gallery")
        $SolutionGalleryRootFolder = $SolutionGallery.RootFolder
        #Get WSP File Name from Path
        $WSPFileName = $WSPFilePath.Substring($WSPFilePath.LastIndexOf("\")+1)
        #Upload the WSP to the solution gallery       
        $WSPFileStream = New-Object System.IO.FileStream($WSPFilePath, [System.IO.FileMode]::Open)
        $FileCI = New-Object Microsoft.SharePoint.Client.FileCreationInformation
        $FileCI.Overwrite = $True
        $FileCI.ContentStream = $WSPFileStream
        $FileCI.URL = $WSPFileName
        $UploadedFile = $SolutionGallery.RootFolder.Files.Add($FileCI)
        Write-Host -f Green "`tUploaded WSP File to Solution Gallery!"  
        #Install the solution
        Write-Host -f Yellow "Installing Solution..."
        $WSP = New-Object Microsoft.SharePoint.Client.Publishing.DesignPackageInfo
        $WSP.PackageGuid = [System.Guid]::Empty
        $WSP.PackageName = $WSPFileName
        $WSP.MajorVersion = $MajorVersion
        $WSP.MinorVersion = $MinorVersion
        #Install the solution from the file url - This creates a solution according to the Major and Minor Version
        $WSPFileURL = $SolutionGallery.RootFolder.ServerRelativeUrl + "/" + $WspFileName;
        [Microsoft.SharePoint.Client.Publishing.DesignPackage]::Install($Ctx, $Ctx.Site, $WSP, $WSPFileURL)
        Write-Host -f Green "`tInstalled the Solution Successfully!"  
        #Activate the solution
        Write-Host -f Yellow "Activating the Solution..."
        [Microsoft.SharePoint.Client.Publishing.DesignPackage]::Apply($Ctx, $Ctx.Site, $WSP)
        Write-Host -f Green "`tActivated the Solution Successfully!"
        #Remove the original wsp file uploaded
        $UploadedSolutionFile = $SolutionGallery.rootFolder.Files.GetByUrl($WSPFileURL)
        Write-Host -f Green "`n*** WSP Deployment has been successfully completed!***"
    catch {
        write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
#Set Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/creditpipeline"
$WSPFilePath  = "C:\Users\salaudeen\Desktop\Crescent-Projects-v2.wsp"
#Get Credentials to connect
$Cred = Get-Credential
#call the function to deploy the solution
Deploy-SPOSolution -SiteURL $SiteURL -WSPFilePath $WspFilePath

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.