I am trying to deploy a SharePoint 2010 project onto an SP server. When I hit F5 after building the solution, the output says that "Only a site collection administrator can activate or upgrade solutions that contain code." Does this mean I have to deploy this on the site collection admin's server account, or can impersonating that admin in web.config suffice?
If the solution contains an assembly, only a site collection administrator can deploy it. If the solution does not contain an assembly, a user who has the Full Control permission level at the root of the site collection can deploy it.
Now Fix to this problem. Add the account into Site collection admin or run the Visual Studio under that account.
How to add the user.Log on the site collection with admin rights and do this
Site Actions->Site Permissions->Click on 'Site Collection Administrators' under 'Edit' tab
Add the id through which you have created sandbox solution.Now deploy your sandbox solution right clicking on solution again.Finally sandbox solution gets deployed into the site
You can choose Run as different user in Visual Studio and give a site collection admin's credentials when starting Visual Studio. Else you can add the current user as a site collection admin and proceed further.