Using SHarePoint 2013, I have done the following in Visual Studio 2013:
- New "Empty SharePoint Project"
- In the Project, added a new item "List" with a definition and an instance
- In the Feature, set the scope to Site (default is Web)
- F5
- Everything works as expected - the feature is Site Collection scoped, and the list instance is automatically created in the root of the Site Collection.
However, when trying to do this manually instead (as on a production server):
- Publish the Project to a .wsp
Add-SPSolution
on the .wspInstall-SPSolution -GACDeployment -WebApplication http://mysharepoint/
In this case, Install-SPSolution
gives the following error:
Install-SPSolution : This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.
If I remove -WebApplication
, the solution can be installed, but the result is that the solution is deployed globally, the Feature becomes Web scoped, and everything is just generally wrong.
All we want is a Site Collection scoped list instance and list definition that is created in the Site Collection root on activation. So the questions that arise are:
- Why does F5 work, when
Install-SPSolution
does not? - What magic does F5 do that cannot be done with a manual install?
- What are we doing wrong?
- Is there something wrong with a Site Collection scoped list definition and/or list instance? If so, why does F5 allow it?