Create SharePoint Project without install SharePoint Server
If you create SharePoint Project on VS2010, you may be prompted an error.
A SharePoint server is not installed on this computer. A SharePoint server must be installed to work with SharePoint Projects
Generally, Microsoft suggested to install sharepoint server on every development machine.
Having SharePoint installed is required. It won't let you create a new project unless its present. I remote debug a lot when MOSS 2007, but with all of the benefits in Visual Studio 2010, it is worth developing directly on the SharePoint server.
But there is some workarround to compile SharePoint project without installing SharePoint server.
Just confirmed .. was able to attach to the remote debugger on the SP2010 virtual machine from a host running VS2010. If your interested in developing locally and remote debugging read on, otherwise follow Corey's advice Once the plumbing is set up, it's pretty easy to remote debug.
I'm using VS2010 RC1 and SP2010 Beta.
Here are the steps to remotely build sharepoint components and remotely debug:
Create, build, and deploy your code
- Build a SP2010 virtual machine
- Install VS2010 on the host machine
- Export the hive [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0] (see attached registry file) from the virtual machine and install on the local machine
- Create a webpart project in VS2010, build, and package.
- Copy the wsp to the virtual machine and the pdb.
- Deploy the wsp via Add-SPSolution.
- Go to Run … enter c:\windows\assembly\gac_msil, find your assembly, copy the pdb to the same folder as the assembly.
Get the debugger running on the virtual machine
- Copy Remote Debugger to SP2010 virtual machine .. found on host at: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger
- Create identical debug user accounts on both the host and guest machines and add to local administrator group on both machines (not sure if admin group is necessary).
- On the virtual machine, start the msvsmon.exe, in the x64 folder using this command: C:\Windows\System32\runas.exe /user:<your debug user account> /netonly "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger\x64\msvsmon.exe"
- On the virtual machine msvsmon, enter the password of the debug user account.
- On the virtual machine msvsmon, go to Tools->Permissions, and grant the debug user account permission to debug.
Attach to the process on the virtual machine from VS2010
- Refresh the page your webpart resides on to get the w3wp process going.
- On the virtual machine determine the process id of the w3wp instance your code is executing. Not sure if IISApp.vbs is on Server 2008 R2, but this link provides a PS script to get the process id.
- On the virtual machine, make a note of the name of the msvsmon instance … mine is CORP\administrator@<server name>.
- In VS2010, Attach to Process, and enter the name of the msvsmon instance in the Qualifier field of the window.
- Look for the instances of w3wp, and attach to the process id your code is executing in.
- Now the obvious step … set a breakpoint in your code, then refresh your page.
Note: 4 & 5 are where most of the issues, if you have any, will take place. If you are unable to see a list of processes running, or even attach to the remote debugger, something is wrong with your debug accounts. Note the id and pwd must be identical on both the host and guest. I have them both in the admin group. Also, be sure your running the x64 debugger.
Happy remote debugging.
Without installing SharePoint Server, you can still reference the SharePoint DLLs by setting assemblies references folder in registry. (http://msdn.microsoft.com/en-us/library/wkze6zky(VS.80).aspx)
DLLs ~\USER-TEMP\KP\SharePoint2010 DLLs.rar
Extract the files to C:\SharePoint2010 DLLs and import MyAssemblies.reg (attached)