Cách tạo dự án Sharepoint bằng VS2010 không cần cài SharePoint
Nếu ta tạo 1 dự án SharePoint bằng VS2010 mà không cài SharePoint 2010 thì sẽ nhận được các lỗi sau:
A SharePoint server is not installed on this computer. A SharePoint server must be installed to work with SharePoint Projects
Thông thường Microsoft khuyên nên cài SharePoint nên các máy Development.
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.
Nhưng như vậy, có rất nhiều nhu cầu xuất hiện như: chúng tôi phải làm nhóm với nhau. tiết kiệm máy chủ SharePoint, máy laptop không thể đủ tài nguyên cho việc vừa lập trình vừa cho chạy SharePoint Server …
Đây là các bước xây dựng dự án SharePoint bằng Visual Studio 2010
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.
1. Build a SP2010 virtual machine
2. Install VS2010 on the host machine
3. Export the hive [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0] from the virtual machine and install on the local machine
4. Create a webpart project in VS2010, build, and package.
I still can’t create sharepoint project after importing the registry keys.
What i tried is to create exactly same folder (in my local machine)
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI
import all the DLL from SP Server to my local machine. and it works!!!
Posted on 18/10/2012, in Công nghệ và Giáo dục, Chính sách CNTT, LOB - Lập trình - Phát triển phần mềm, Microsoft, Microsoft SharePoint 2010, Visual Studio 2010 and tagged Microsoft. Bookmark the permalink. Để lại phản hồi.