1

So I got this code left by a former colleague of a developed added functionality (I say "added functionality" because I'm really not sure what it is) for SharePoint 2013 (with a Project Server 2013 instance installed), however when I try the Deploy option in Visual Studio, the functionality (which I thought to be a web part), doesn't show up on the Web Part gallery. During the ongoing work of trying to discover how to properly deploy this, I found out about SharePoint Features, and how a solution can be used as a vessel to install a feature, so at this point I'm wondering, "Is this the code of a Solution or of a Feature?"

How can I tel them apart from looking at the code?

1

By looking at the Visual Studio solution (not to be confused with a SharePoint solution WSP), you can easily tell what you have:

In the Visual Studio project (from the Solution Explorer of VS), if you see a "Features" folder with one or more sub-folders in it: you have a SharePoint project that builds into a SharePoint WSP package. That package contains one or more features. Steps to deploy it (avoid using "F5") are: add the WSP (from PowerShell), install the WSP (from CA or PowerShell) and then activate the feature (from Web UI, go to Site Settings). You can find these steps for instance here (they're missing the very first step, witch is to create the package from VS, i.e. clicking "Package" -aka "Publish" from VS2012).

Note that from VS you can also see what components (elements) your features embed: from the "Features" folder, double-click on each sub-folder (one sub-folder is a feature). This will bring you to a feature designer page, where, in the right pane, you can consult what elements (Web parts, custom actions, workflows...) are included.

Also, note that SharePoint solutions do not really use code: they're just a package (a .cab file: you can even rename a .wsp to .cab to get all the contents). That package contains generally a DLL (the actual code written by the developer) and features. Features are made of declarative XML elements. Some elements (like Web parts) use code from the DLL.

EDIT
From the comments, I understood your solution is actually a sandbox solution, not a farm solution. It mean you don't deploy it farm-wide from PowerShell/CA/any admin tool, but by uploading the WSP to the solution galery of each site collection. And then, you activate it from the ribbon.

  • Quick question, when you say that the 3rd link is missing the Publish step, does it mean that from VS I should Publish first to get the WSP? Because I thought that would put the WSP in the SharePoint. Shouldn't I use the Build option instead? – Pedro Gordo Jan 25 '16 at 10:47
  • 1
    Yeah, that "Publish" button is completely missleading in VS2012+. Used to be "Package", that was much clearer and depicted the correct action. "Publish" will only create the WSP. Deploying to SharePoint is either "F5" or "Deploy". – Evariste Jan 25 '16 at 10:56
  • Clicking on "Publish", it gives me the option to publish to a web site, or to the file system. I'm going to assume I should choose the file system option :) No need to reply if I'm assuming right. Thanks for your help man! – Pedro Gordo Jan 25 '16 at 10:59
  • 1
    You're correct, but I have to anwser, because: if the option to publish to a SharePoint Web site is enabled, it means you have a sandbox solution... and depoyment steps for sandbox is another story... I'll edit my post. – Evariste Jan 25 '16 at 11:00
1
  1. Open the project folder
  2. You will find the "Feature" folder inside that. If you have any other .cs or .aspx files outside the folder, then it might be solution.
  3. If you don't have any thing outside of the "Feature" folder and you have files inside the "Feature" folder, then it is a FEATURE.
  4. Project can also contain the solution as well as the feature.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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