3

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.

1 Answer 1

1

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.

6
  • I am error with the provided command. The error is: "The Feature is not a Farm Level Feature and is not found in a Site level defined by the Url sharepointpilot." There are four options for the scope of the feature in Visual Studio. With "Farm" or "WebApplication" I get an error in Visual Studio. With "Site" or "Web" I get an error in PowerShell. Sep 30, 2016 at 1:40
  • Is it site collection level feature or web application?
    – Waqas Sarwar MVP
    Sep 30, 2016 at 1:49
  • Can you see that feature on site collection settings page? sharepoint.stackexchange.com/questions/22832/…
    – Waqas Sarwar MVP
    Sep 30, 2016 at 1:53
  • I am new to SharePoint development, but I believe it should be a site collection level feature. It is a site template with three site page instances of the template created through an Elements.xml file. Sep 30, 2016 at 1:54
  • 1

Your Answer

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

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