Naming Your Projects

SharePoint Service Applications contain many parts that need to be named uniquely so as not to collide with other artifacts that live in the SharePoint Hive. When creating a new project from the Service Application Starter Kit templates, it is important to name the project meaningfully, and to be aware of how the different parts will be named.

TIP: Keep your name short, to the point, and don’t suffix with “Service” or “ServiceApplication” (the templates do this for you already).

Let’s run through an example.

An Example Service Application - ContosoAnalytics

Pretending that we were to create a service application for Contoso, called “Contoso Analytics”, let’s walk through naming the project and observe how the naming trickles down to the various project elements.

From the File > New Project dialog, select SharePoint 2013 WCF/REST Service Application w/ Custom Database. In the project name and solution name box, enter the following short name for the project:ContosoAnalytics.

create new dialog

After creation, you will have a directory structure similar to the following:

  • ContosoAnalytics
    • ContosoAnalytics.sln
    • ContosoAnalytics
      • ContosoAnalytics.Client
        • ConsotoAnalytics.Client.csproj
      • ContosoAnalytics.Service
        • ContosoAnalytics.Service.csproj

After creation, you will have two projects, ContosoAnalytics.Client (containing the REST services), and ContosoAnalytics.Service (containing the actual service application). The Assembly Name, Default Namespace, and WSP package name will all match the project name. For example, for the service project:

  • Assembly Name: ContosoAnalytics.Service.dll
  • Default namespace: ContosoAnalytics.Service
  • WSP Package name: ContosoAnalytics.Service.wsp

Following are some examples of how the Project Name trickles down to the naming of the various files and subfolders in the projects:

  • ContosoAnalytics.Client
    • ISAPI
      • ContosoAnalytics.Client
        • HelloWorld.svc
  • ContosoAnalytics.Service
    • ADMIN
      • ContosoAnalytics.Service
        • ManageApplication.aspx
    • CONFIG/ADMINRESOURCES
      • ContosoAnalytics.Service.ServiceAdminResources.resx
    • SQL
      • ContosoAnalytics.Service
        • CreateDatabase.sql
    • WEBSERVICES
      • ContosoAnalytics.Service
        • HelloWorld.svc
    • RESOURCES
      • ContosoAnalytics.Service.ServiceResources.resx
    • REGISTRATION
      • ContosoAnalytics.Service.Powershell.Cdmlets.xml
    • ContosoAnalyticsService.cs
    • ContosoAnalyticsServiceProxy.cs
    • ContosoAnalyticsServiceApplication.cs
    • ContosoAnalyticsServiceApplicationProxy.cs
    • ContosoAnalyticsServiceInstance.cs

 

In future versions of this project I hope to include better control over naming, possibly through a Wizard dialog.

Last edited Feb 11, 2013 at 11:28 PM by adamtoth, version 3

Comments

No comments yet.