Question

I am attempting to install a farm solution with a Jenkins job so I need to do everything through PowerShell. So with PowerShell scripts I can:

  • Create a web application
  • Create a site collection
  • Deploy a custom master page

What I still need to do is (unless I am missing something):

  • Deploy a solution
  • Deploy visual web parts to the web part library

I can create an "Empty SharePoint 2013" project in Visual Studio, edit the appropriate files, and deploy it successfully through Visual Studio. When I go to the URL my solution should deploy to, everything works. But when I try to deploy through PowerShell, I get a different result. When I run the following PowerShell script:

# Deploy and Install Solution

# ---- CONFIGURATION BLOCK ----
$site = "http://sharepointpilot/"
# The file found at ($solutionPath + "\" + $solutionName) must be a WSP file
$solutionPath = "C:\SharePointPilot\dir\dir\bin\Debug"
$solutionName = "solution.wsp"

# ---- CODE ----
$web = Get-WebApplication -Site $site
Add-SPSolution -LiteralPath ($solutionPath + "\" + $solutionName)
Install-SPSolution -Identity $solutionName -GACDeployment

It installs, but does not deploy correctly.

When I run:

# Print XML Format of Solution Information
stsadm -o enumsolutions

I get the following:

<Solutions Count="1">
   <Solution Name="solution.wsp">
      <Id>1b9fc6b2-1fb0-43b7-982e-5e0643800694</Id>
      <File>solution.wsp</File>
      <Deployed>TRUE</Deployed>
      <WebApplicationSpecific>FALSE</WebApplicationSpecific>
      <ContainsGlobalAssembly>TRUE</ContainsGlobalAssembly>
      <ContainsFullTrustBinAssembly>FALSE</ContainsFullTrustBinAssembly>
      <ContainsCodeAccessSecurityPolicy>FALSE</ContainsCodeAccessSecurityPolicy>
      <LastOperationResult>DeploymentSucceeded</LastOperationResult>
      <LastOperationTime>9/29/2016 6:46 PM</LastOperationTime>
   </Solution>
</Solutions>

When I go to the URL my solution is supposed to be deployed, I get a 404 error.

I did notice when deploying in Visual Studio it says "enabling features" in the output. I tried to research that, but it ended up going nowhere.

If you can offer any help at all, it would be appreciated. Thanks for reading.

Was it helpful?

Solution

What I am seeing is the enabling feature part is missing. Solution deployment most 3 steps process

  1. Add solution, which u did
  2. Install solution, you already did
  3. Now missing part is enabling the feature on your site collection. Use following codeEnable-SPFeature -Url "[Site Collection URL]" -Identity "solution identity "

After enabling l, you will see it.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top