Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

EDIT to add more detail about what I'm trying to do:

This is the first SP project I've worked on, so I might be making a very basic mistake with how the project is set up. The project consists of a custom list for configuration data, which is modified via two custom application pages. There are also a couple of other application pages for custom functionality accessible by any user. There are also a couple of web services through which an outside website will access the data from that custom functionality.

The production web application contains a single site collection with multiple sites. Each element of the project should be installed to every site within that site collection, so the application pages and web services on each site are specific to that site only.

END EDIT

I have a SharePoint solution within VS which contains two custom web services, several application pages, and a feature event handler. I'd like the feature to be available in every sub site within a site collection, with different data for each. My single feature is scoped to Site, and iterates through each web within the site collection in the FeatureActivated event to perform certain processing (adding of menu items linked to the application pages). The feature contains the two web services, but there's no option to include the application pages as "items in the solution".

The entire solution works fine when I deploy through Visual Studio. However, this was on a development machine and I now need to move to test. My understanding is that I should be able to do this using the WSP file through Powershell and/or Central Admin. This is where I'm running into issues.

Running Add-SPSolution works just fine (Add-SPSolution "C:\featurepackage.wsp"), but Install-SPSolution (Install-SPSolution -Identity FeaturePackage.wsp -WebApplication http:// nameofserver -GacDeployment) gives me an error on scope - there are no web application scoped items. Which makes sense, since my feature is Site scoped. I couldn't find any information on PS commands to install a solution that is Site scoped.

After some searching, I figured out that the solution was listed in the Farm solutions page of Central Admin. The only options I was given were to deploy it globally. On test and prod, there's only a single web application, so although I would've preferred to deploy just to the single web application which contains my site collection, that would work.

I received no errors once I'd deployed through Farm Solution Management, but when I checked the site settings for any of the sites (one menu inserted during feature activation is under site settings), there were no new menu options. I also get a 503 (service unavailable) error when trying to go directly to one of the new application pages. So it doesn't seem to actually be deployed. Am I missing a step here, or completely off-target? Any help would be very much appreciated.

Here's the solution screenshot:

Solution Screenshot

Here is the manifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="4e02717b-9a15-4a9c-9e05-a7575163aeca" SharePointProductVersion="14.0">
  <Assemblies>
    <Assembly Location="Newtonsoft.Json.dll" DeploymentTarget="GlobalAssemblyCache" />
    <Assembly Location="Feature.dll" DeploymentTarget="GlobalAssemblyCache" />
  </Assemblies>
  <RootFiles>
    <RootFile Location="ISAPI\WebService1.svc" />
    <RootFile Location="ISAPI\WebService2.svc" />
    <RootFile Location="ISAPI\WebService3.svc" />
  </RootFiles>
  <TemplateFiles>
    <TemplateFile Location="Layouts\Config\Configuration.aspx" />
    <TemplateFile Location="Layouts\Config\Mappings.aspx" />
    <TemplateFile Location="Layouts\Feature\script.js" />
    <TemplateFile Location="Layouts\Feature\Add.aspx" />
    <TemplateFile Location="Layouts\Feature\View.aspx" />
  </TemplateFiles>
  <FeatureManifests>
    <FeatureManifest Location="Feature_Configuration\Feature.xml" />
  </FeatureManifests>
</Solution>

And Feature.xml:

<?xml version="1.0" encoding="utf-8"?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/" AutoActivateInCentralAdmin="TRUE" Description="Adds custom content in order to configure Feature" Id="4bd05979-61b2-4ca1-8f4f-ac929816cbeb" ReceiverAssembly="Feature, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6bf86656d0472a39" ReceiverClass="Feature.Features.Configuration.ConfigurationEventReceiver" Scope="Site" Title="Configuration"></Feature>
share|improve this question
    
Is the feature set to Activate on default in Visual Studio? If not, you will ha to manually activate it on every sitecollection (in settings or through a powershell script) –  Robert Lindgren Jul 26 '13 at 5:14
    
ummmm. Can you please post a screenshot of your solution as displayed in visual studio solution explorer? I want to see how you created the two application pages. –  SPArchaeologist Jul 26 '13 at 7:35
    
@RobertLindgren - the feature is set to activate on default, and does when deployed through VS. –  virtuesplea Jul 29 '13 at 17:48
    
@SPArchaeologist, I added a screenshot. –  virtuesplea Jul 29 '13 at 17:49
    
@virtuesplea - see if my response helps you - and feel free to ask for more detail or guidance. Also, free to edit the question if you need, just leave me a comment so that I will get an alert to remember me to check back ^_^ –  SPArchaeologist Jul 30 '13 at 10:09
add comment

2 Answers 2

up vote 0 down vote accepted

It would seems that your problems are caused by some common misconceptions about SharePoint projects structure and deploy steps.

Let me start from the end. The add-solution / install-solution step. As you may have guessed, adding a solution just "uploads" the solution to SharePoint (there are actually some deeper implication, but let's keep it simple). To start using it you must "deploy" it to some target.

Now, you may believe that "deploying" a solution to a specific web application means that the solution components will be available only to that web application - for example, only site collection in that web applications will show a feature in the solution. This isn't true*: only a subset of solution artifacts are specific to the web applications you deploy your solution to - most of the solution components are available to all app.*

This implies that if you deploy a solution to web app A any feature available in the solution will still be visible in sites in web app B. This also explain your first issue:

Install-SPSolution (Install-SPSolution -Identity FeaturePackage.wsp -WebApplication http:// nameofserver -GacDeployment) gives me an error on scope - there are no web application scoped items. Which makes sense, since my feature is Site scoped. I couldn't find any information on PS commands to install a solution that is Site scoped.

Your solution do not contain items that are web application scoped (for example: a resource file deployed to the app virtual directory) so it doesn't make sense to deploy it to a specific app.

Second question:

there's no option to include the application pages as "items in the solution".

Your "application pages" are pages that reside in the "Layouts" folder in the /14 folder of your SharePoint installation. You can access them with the virtual url "_layouts". Since they are deployed to the layout folder, they are visible EVERYWHERE in your SharePoint solution, just like "settings.aspx" or any other of the pages available in that folder (see above point). But... how does that files end up included in the solution package and then deployed to the Layouts folder? you didn't add them to a feature, didn't you? Actually, the response is in the "Layouts" folder in your Visual Studio solution. You see the little symbol on the folder - the world like icon? That means that that folder is a "mapped folder" ie that that folder is mapped to a folder in the 14 root dir: any item under that folder in the visual studio solution will be included in the solution package to be copied to the mapped position on the SharePoint server. This explain why the solution manifest contains the following rows:

<TemplateFiles>
   <TemplateFile Location="Layouts\Config\Configuration.aspx" />
   <TemplateFile Location="Layouts\Config\Mappings.aspx" />
   <TemplateFile Location="Layouts\Feature\script.js" />
   <TemplateFile Location="Layouts\Feature\Add.aspx" />
   <TemplateFile Location="Layouts\Feature\View.aspx" />
</TemplateFiles>

So... why are you receiving an error when you try to access the above pages? I cannot be sure, but based on the error types I have some theories:

  • you try to access the page during an app pool recycle?
  • the application pool is down?
  • your pages try to access one of the web services - which in turn does not exist? (see below)?
  • are you using a wrong url?

As you see, pretty wild guessing here. I can just suggest that you have a look at the SharePoint ULS log - maybe you can find something more specific.

There is one last thing that brother me though. Your solution manifest contains

<RootFiles>
   <RootFile Location="ISAPI\WebService1.svc" />
   <RootFile Location="ISAPI\WebService2.svc" />
   <RootFile Location="ISAPI\WebService3.svc" />
</RootFiles>

What are those file doing there? Based on your screenshot, the web services .svc file have different names. Also - there is no sign of the actuals .svc files begin deployed somewhere. Are you sure that your web service are begin deployed correctly? Can you access them?

Last notice: you also mention using a feature receiver to configure "links" in the site collection. I don't get what you are doing specifically... but just in case, have a look at custom actions definition and the publishing infrastructure. I have the felling that your solution could be simplified somehow.

share|improve this answer
    
This hasn't completely solved my problem, but I think I'm close. You had a few comments that I wanted to answer. I was receiving an error trying to access the application pages because when the feature installs, it throws an exception and takes down the application pool. Separately, the web services I listed in the manifest, I renamed, without realizing I didn't do the same to the screenshot. They aren't added to any feature (doing so gives me an error when I try to package the solution), but they are accessible once I restart the application pool in IIS, as are the application pages. –  virtuesplea Jul 31 '13 at 22:50
    
@virtuesplea - I suspected something similar. Anyway, you said you still have some problems - can I help you in some way? There is something specific you are stuck on? –  SPArchaeologist Aug 1 '13 at 8:43
    
I'm trying a couple different ways of setting the solution up, and if I don't have luck with those, I'll post another question and link it back here. Thanks! –  virtuesplea Aug 1 '13 at 14:45
add comment

Try with this powershell. It works for my deployments.

#$SolutionPath is the path to your .wsp file
Add-SPSolution -LiteralPath $SolutionPath

$SolutionToInstall = Get-SPSolution -Identity "Your_Solution_without_path.wsp"
Install-SPSolution -Identity $SolutionToInstall -GACDeployment -Force 

This will install to all web applications

Try this for a single web application

Install-SPSolution -Identity $SolutionToInstall -WebApplication $Url -FullTrustBinDeployment -Force  -WarningAction Ignore

Good Luck

share|improve this answer
    
I don't want to install to all web applications, so I didn't try the first Install-SPSolution command. The second, "A parameter cannot be found that matches parameter name "FullTrustBinDeployment". I used -GacDeployment instaed, and get the same error message I reported in the OP - "This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application" –  virtuesplea Jul 29 '13 at 17:47
    
Could you post your Feature.xml and manifest.xml files? I think you are confusing between solution and feature. The feature is always deployed globally and activated depending on the scope but the solution is the one you can choose whether to install to single web app or globally. In the first case (WA) why don't you choose in the project options Assembly Deployment Target to WebApplication? –  Alvmad Jul 29 '13 at 21:25
    
I've added both the text of both xml files to the OP. I also tried to change the Assembly Deployment Target to WebApplication, but that got me a security violation on one of the custom application pages. –  virtuesplea Jul 29 '13 at 21:47
    
I also added more detail at the top of the OP as to what I'm trying to accomplish –  virtuesplea Jul 29 '13 at 22:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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