Troubleshooting Common Development Issues in the Microsoft SharePoint 2013 Software Development Kit
Developing with the Microsoft SharePoint 2013 Software Development Kit (SDK) can speed up building custom solutions, but developers often run into common issues. This guide lists frequent problems, their root causes, and concise, actionable fixes to get your SharePoint development back on track.
1. SDK installation failures or missing templates
- Cause: Incomplete prerequisites, corrupted installer, or incorrect Visual Studio version.
- Fixes:
- Verify prerequisites: Install the required .NET Framework, Windows updates, and Visual Studio ⁄2013 (as supported).
- Run installer as Administrator and temporarily disable antivirus.
- Repair Visual Studio if SharePoint project templates are missing: Visual Studio Installer → Modify → Workloads/Features → ensure Office/SharePoint development tools are selected.
- Manually import templates: Copy .zip template files from SDK install folder into Visual Studio’s ProjectTemplates folder and run
devenv /installvstemplates.
2. “Unable to connect to SharePoint site” from Visual Studio
- Cause: Permissions, wrong URL, SharePoint service not running, or loopback check on the dev machine.
- Fixes:
- Confirm URL and access: Open site in browser using same account.
- Run Visual Studio as Administrator and use an account with Site Collection Administrator rights.
- Check services: Ensure SharePoint Timer Service and IIS are running.
- Disable loopback check for local dev (Windows): Add registry entry
DisableLoopbackCheck = 1underHKLM\SYSTEM\CurrentControlSet\Control\Lsaor better, add specific host names toBackConnectionHostNames. Reboot after change. (Use caution and follow security guidance.)
3. Deployment errors (retract/activate/feature errors)
- Cause: Stale files, feature scope mismatch, file locks, or assembly binding issues.
- Fixes:
- IIS reset and recycle app pools:
iisresetand recycle the target app pool. - Clear the GAC and bin duplicates: Remove old assembly versions from the GAC and web app bin. Re-deploy cleanly.
- Ensure correct feature scope: Check feature.xml scope matches intended deployment (Web, Site, WebApplication, or Farm).
- Use SharePoint Management Shell: Retract/Remove-SPSolution and Add-SPSolution/Deploy-SPSolution with
-Forceif necessary, and check ULS logs for error details. - Unlock locked files: Stop app pool or use tools like Handle/Process Explorer to release locks.
- IIS reset and recycle app pools:
4. Missing or null SPContext / HttpContext in custom pages and services
- Cause: Running code outside SharePoint HTTP pipeline (timer jobs, console apps, remote calls) or improper context initialization.
- Fixes:
- Use SPSite/SPWeb using statements when running outside HTTP context:
using (SPSite site = new SPSite(url)) { using (SPWeb web = site.OpenWeb()) { /work here */ } }
- For provider-hosted apps or remote operations, use the Client-Side Object Model (CSOM) or REST with proper app-only or user credentials.
- For service endpoints, pass necessary context tokens or perform explicit authentication.
- Use SPSite/SPWeb using statements when running outside HTTP context:
5. Incorrect permissions or access denied at runtime
- Cause: App pool identity lacks rights, code running with insufficient privileges, or missing SharePoint permissions for the app.
- Fixes:
- Run elevated code when required: Wrap operations needing farm or elevated rights using
SPSecurity.RunWithElevatedPrivileges. - Grant correct permissions: Ensure app pool account has needed database and SharePoint rights, or set proper app permissions in app manifest.
- Avoid using RunWithElevatedPrivileges for user context operations—instead use app permissions or app-only policies where appropriate.
- Run elevated code when required: Wrap operations needing farm or elevated rights using
6. Slow performance in development or code executing slowly
- Cause: Inefficient queries, lack of caching, excessive SPWeb/SPList instantiations, or improper disposal.
- Fixes:
- Use SPQuery with RowLimit and ViewFields to limit returned data.
- Cache objects where appropriate (e.g., SPList references) and avoid repeated OpenWeb/OpenSite calls.
- Always dispose SPSite/SPWeb (use using blocks) to prevent memory leaks.
- Profile with ULS and Developer Dashboard to find slow calls and optimize.
7. CSOM/REST authentication failures in remote apps
- Cause: Incorrect OAuth flow, expired tokens, or misconfigured app principal.
- Fixes:
- Validate app registration (Add-In registration or Azure AD app) and redirect URIs.
- Refresh tokens properly and handle token expiry.
- Test REST calls with Fiddler/Postman to isolate whether the issue is auth or payload related.
8. Web part rendering errors and JavaScript issues
- Cause: Missing script references, conflicting libraries, or incorrect SafeControl entries.
- Fixes:
- Ensure scripts are referenced correctly, use ScriptLink for SharePoint-hosted scripts.
- Check for jQuery conflicts (use noConflict or scoped versions).
- Add SafeControl entries for custom web part assemblies in web.config when deploying full-trust solutions.
- Use browser dev tools to inspect console errors and network requests.
9. Feature not activating or not visible in UI
- Cause: Wrong scope, hidden attribute set to TRUE, or feature receiver errors.
- Fixes:
- Verify feature scope and locate UI location: Site-scoped features appear under Site Settings → Site features; Web-scoped under Site Actions.
- Check Feature.xml for
Hidden=“TRUE”; set to FALSE if you want it visible. - Inspect feature receiver logs for exceptions during activation and fix any code issues.
10. Troubleshooting tips and tools
- Immediate checks: Event Viewer, ULS logs, Windows Application logs, IIS logs.
- Useful tools: SharePoint Management Shell, Developer Dashboard, Fiddler, ULS Viewer, Visual Studio diagnostic tools, Process Explorer.
- Debugging: Attach Visual Studio debugger to w3wp.exe for server-side code; use remote debugging if developing on a different machine.
- Logging best practice: Implement detailed logging in feature receivers and custom code; include correlation IDs and trace to ULS or custom logs.
Quick triage checklist
- Can you open the SharePoint site in a browser with the same account?
- Are SharePoint services and IIS running?
- Do Visual Studio and SharePoint versions match SDK requirements?
- Are SPSite/SPWeb objects properly disposed?
- Check ULS and Event Viewer for correlation IDs and errors.
If you want, I can generate specific PowerShell commands, sample code snippets (C#/CSOM/REST), or a one-page checklist tailored to your environment.
Leave a Reply