"The day you stop learning SharePoint is the day you stop using it."

You can remotely debug a SharePoint farm solution in
your local Visual Studio without having SharePoint locally installed.

Assumptions:

1. You
have a ready on premise SharePoint Server

2.You
have Visual Studio 2013 installed on your local machine. (ex. Windows 7/Windows
10)3.You have created identical debug user accounts
on both the local host and server machines and add to Local Administrator group
on both machines (not sure if admin group is necessary, but better to add it in
Administrators group).

3. In the
below wizard, do not change any values, do not click Validate. Simply click
Finish.

4. Copy
the required SharePoint DLL to your local development machine and add them to
References in your VS solution. (I added only Microsoft.SharePoint.dll. You may
need more SharePoint DLL depending on SharePoint classes used in your code.)

Configuration
Steps:

1. When
you are done coding, build the solution and copy pdb file to the SharePoint
server. (You will find this pdb file in bin folder)

2. Right
click solution and choose Publish. This will create wsp file.

3. Copy
this wsp file to the SharePoint server and deploy the solution:

Use
Add-SPSolution and
Install-SPSolution.

4. Activate the web part from Site Settings and add
it to any SharePoint page.

5. Navigate
to one of the below location to find your solution folder:

C:\Windows\assembly\
GAC_MSIL\

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\

6. Copy the pdb file to your solution folder. Now your
solution’s DLL and PDB file are in same folder.

7. On the SharePoint server navigate to [C:\Program
Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Remote Debugger\x64]
and run msvsmon.exe as Administrator. You will have below window now running.

8. In
the Debugging Monitor window choose > Tools > Permissions and check if
the account by which you are running your Visual Studio on your local machine
has Debug permission, if not grant it.

9. Open
Windows PowerShell on SharePoint Server and run this command:

C:\Windows\System32\inetsrv\appcmd list
wp

This command will list all WP process
currently running. Note down the WP process ID that you want to attach in
Visual Studio. (Example shown below. My Web Part is deployed to 11724,
therefore I will choose only this WP ID while attaching to the process in
Visual Studio).

SharePoint-StackExchange Moderator

Author's Profile

A SharePoint Enthusiast working as a Project Lead for an IT Software & Consulting Company in Mumbai. I believe in giving back to the community through which I also learn and develop and eventually grow as an individual and professional. This blog is a small contribution to the community where I live in and may help someone who is seeking knowledge like me.
Apart from being a SharePoint Enthusiasts, I am a husband, a father and a blogger. I love to travel and explore new landscapes and meet people of various culture. I am passionate about learning new technology trends in IT. I love spending time on my fitness and have a deep enthusiasm for urdu poetry and career counseling.