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

  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] (see attached registry file) from the virtual machine and install on the local machine
  4. Create a webpart project in VS2010, build, and package.
  5. Copy the wsp to the virtual machine and the pdb.
  6. Deploy the wsp via Add-SPSolution.
  7. 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

  1. Copy Remote Debugger to SP2010 virtual machine .. found on host at: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger
  2. 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).
  3. 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”
  4. On the virtual machine msvsmon, enter the password of the debug user account.
  5. 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

  1. Refresh the page your webpart resides on to get the w3wp process going.
  2. 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.
  3. On the virtual machine, make a note of the name of the msvsmon instance … mine is CORP\administrator@<server name>.
  4. In VS2010, Attach to Process, and enter the name of the msvsmon instance in the Qualifier field of the window.
  5. Look for the instances of w3wp, and attach to the process id your code is executing in.
  6. 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!!!

About thangletoan

Hallo Aloha

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 . Bookmark the permalink. Để lại bình luận.

Gửi phản hồi

Mời bạn điền thông tin vào ô dưới đây hoặc kích vào một biểu tượng để đăng nhập:

WordPress.com Logo

Bạn đang bình luận bằng tài khoản WordPress.com Log Out / Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Log Out / Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Log Out / Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Log Out / Thay đổi )

Connecting to %s

%d bloggers like this: