Introduction
We all know that Sandboxed solutions (custom managed code) have been deprecated from SharePoint 2013. So it is also deprecated in SharePoint 2016. The alternative of Sandboxed solution is App. But the good news is: existing Sandboxed solution still works in SharePoint 2016. There is an issue to deploy existing Sandboxed solution in SharePoint 2016 environment. It does not work seamlessly like SharePoint 2013. So we will see here how we can expedite Sandboxed solution in SharePoint 2016.
Installing Sandboxed Solution
If you try to install Sandboxed solutions using PowerShell in your SharePoint 2016 on-premise environment, then you will get the following error.
PowerShell Command
Install-SPUserSolution -Identity <Solution Name> -Site <Site Url>
Error
Install-SPUserSolution : Failed to activate this solution. The contents of the
solution require the Solution Sandbox service to be running.
What’s the Error
The error simply means that Microsoft SharePoint Foundation Sandboxed Code Service is not running on the server.
Solution
May be you already got that we have to start this service on the server but the problem is in SharePoint 2016, we cannot start any service from Manage services on server. It was possible in SharePoint 2013. You can check it from:
Central Admin –> Application Management –> Manage services on server
To start this service, you have to run the configuration wizard again. In SharePoint 2016, there is a new section in configuration wizard named Services. So look for the Microsoft SharePoint Foundation Sandboxed Code Service and mark the checkbox. Finally, run and finish your configuration wizard.
After running configuration wizard, check the Microsoft SharePoint Foundation Sandboxed Code Service and its status should show running.
Now run the PowerShell command again to deploy your custom sandboxed solution.
Conclusion
You must have to perform this for production deployment. In the test or development environment, it is not required. Visual Studio will automatically do this for you to deploy and test your sandboxed solution!