Exercise 2: Importing the VSeWSS project into Visual Studio 2010

  1. Using the Windows Explorer navigate to the lab folder.
  2. Navigate to the Starter Files folder and inside of this the ProjectManagement folder and then into the ProjectLocatorWebPart subfolder. Open the ProjectLocatorWebPart.webpart file in Visual Studio 2010.
  3. Examine the contents of the ProjectLocatorWebPart.webpart file. Take note of how the Web Part class name (i.e. type name) is defined using a GUID that is replaced at packaging time by VSeWSS.
  4. Navigate back to the ProjectManagement folder and open the Project folder. Open the Project.xml file which contains the ‘Project’ content type definition. Notice how the event receiver class for this content type is also defined using a GUID token.
  5. Next navigate to the Properties folder and open the Attributes.cs file. Notice how these classes are in the VSeWSS namespace. VSeWSS generates these classes to assist in the WSP packaging process.
  6. Open Visual Studio 2010.
  7. On the Start Page that appears, choose New Project in order to show the New Project dialog.
  8. In the New Project dialog perform the following tasks.
    1. Under Installed Templates, expand Visual C# SharePoint 2010.
    2. In the right-hand pane, select the Import VSeWSS Project template.
    3. In the . Framework version selector, choose . Framework 3.5.
    4. For Project Name enter ProjectManagement.
    5. Note:
      Note that it is very important to name your project the same as the project you will import. This ensures that the assembly names match in both the VSeWSS project and the Visual Studio 2010 import result.
    6. Choose OK to close the dialog and show the SharePoint Customization Wizard.
  9. In the SharePoint Customization Wizard dialog that appears, choose http://intranet.contoso.com/sites/Labxx/ as the site to debug the solution with and choose Deploy as a sandboxed solution. Choose Next to continue the import wizard.
  10. In the second page of the import wizard, Browse to the location of the VSeWSS project that you will import. You find the VSeWSS project in the xx_UpgradingVSeWSSSolutions lab folder >> Starter Files >> ProjectManagement folder. Select the ProjectManagement.csproj file in this folder and click Open and then click Finish to complete the import wizard and import the project into Visual Studio 2010.

  11. Review the Error List for any issues that occurred during the import process. Notice how the import updated some assembly references and that there is one import issue to resolve. The choice for deploying as a sandboxed solution is not allowed because of the User Control being deployed to the _controltemplates folder. Sandboxed solutions do not allow files to be deployed on the file system of servers in the SharePoint farm. In order to resolve this issue you can either re-implement the User Control as a Web Server Control, or you can instead opt to deploy the project as a Full Trust solution.

  12. In order to resolve this import issue, configure the project to be deployed as a full-trust solution. In the Solution Explorer, locate the ProjectManagement project. Left-click the project and navigate to the Properties window (lower right corner). In the Properties window, for Sandboxed Solution, choose False. Dismiss the warning that appears using the Yes button.

  13. In the Solution Explorer, expand the ProjectManagement project and ProjectLocatorWebPart folder. Right-click the ProjectLocatorWebPart.webpart file and choose Open in order to view the contents of this file. Take note of the Web Part class name (i.e. type name). Earlier VSeWSS defined the name using a GUID that was replaced at packaging time. The import process converted this GUID to the special token $SharePoint.Project.AssemblyFullName$.
  14. In the Solution Explorer, expand the Project folder. Right-click the Project.xml file and choose Open in order to view the contents of this file. Take note of the class name of the event receiver. The import process also replaced this GUID with a special token, $SharePoint.Project.AssemblyFullName$.
  15. In the Solution Explorer, right-click the ProjectManagement project and choose Properties in order to view the project settings. On the Build tab, notice how the project level settings from the VSeWSS project have been transferred into Visual Studio 2010.
Note:
This concludes exercise 2. You have now successfully imported the VSeWSS 1.3 project into Visual Studio 2010. You have resolved the import issue by ensuring that you deploy the project as a farm solution and you have reviewed some of the automated changes that were made to the project files because of the differences in the packaging model used by VSeWSS and Visual Studio 2010.