Friday, 9 November 2018

Add new feature for habitat project solution - Creating a new Feature Module

In this exercise we will create a new feature module in our solution.
Modules are a conceptual grouping of all assets related to a single business requirement. When working in a Helix solution, you will create modules to contain all of these assets by following the steps we walk through in this exercise, leveraging Visual Studio and File Explorer.
Creating a new Feature Module
The following steps are required for creating the Events module in Visual studio:
  1. Open Windows File Explorer and navigate to c:/projects/sitecore.demo.group
    1. Create the following folder structure: /src/Feature/Events
  2. Open Visual Studio 2017
    1. Open the Habitat Group website solution from c:/projects/sitecore.demo.group
    2. Create a Solution folder in the root named “Feature”
    3. Create a Solution folder in “Feature” named “Events”
  3. Create a new Visual Studio Project in the “Events” folder:
    1. Use the “ASP.NET Web Application” template
    2. Location should be “C:\Projects\Sitecore.Demo.Group\src\Feature\Events”
    3. Name should be “code” as this will create the correct folder structure. We'll rename the project in the next step.
    4. On the next screen, choose the “Empty” template and check the “MVC folders” checkbox
  4. Set the properties for the new project
    1. Rename the project to “Sitecore.Feature.Events”
    2. In the project properties set the assembly name and namespace to “Sitecore.Feature.Events”
    3. Update the project to .NET Framework 4.6.2
    4. Delete the App_Data, App_Start and Global.asax files and folders
  5. Ensure the web.config is not published with the project
    1. Open properties for the web.config and /views/web.config files
    2. Set “Build Action” to “None”
  6. Add configuration files
    1. Under App_Config/Include, create a folder named “Feature”.
  7. Add Sitecore Kernel NuGet reference
    1. Right-click the project and select "Manage NuGet Packages"
    2. Change package source to the Sitecore NuGet feed
      1. See https://doc.sitecore.net/sitecore_experience_platform/developing/developing_with_sitecore/sitecore_public_nuget_packages_faq
    3. Click Browse
    4. Find and install Sitecore.Kernel.NoReferences, and select version 9.0.180604
    5. Find and install Sitecore.Mvc.NoReferences, and select version 9.0.180604
  8. Set publish options
    1. Copy the “/Properties/PublishProfiles” folder from the Project/Sitecore.Demo.Group project into the same place in the Sitecore.Feature.Events project
  9. Publish the project (note -- we're using Gulp in this workshop to do publishing and deployment, not Web Deploy)
    1. Save the Visual Studio solution
    2. In the Task Runner window, run “Publish all Projects”. If Task Runner Explorer isn't visible in your workspace, you can add it by selecting View -> Other Windows -> Task Runner Explorer in Visual Studio.

1 comment:

  1. Added new post here:
    https://ramalingareddymareddy.blogspot.com/2021/05/visual-studio-project-template-for.html

    ReplyDelete

Extracting Nupkg files using command line

Rename it to zip first then extract files as below 1.     Rename-Item -Path A_Package.nupkg -NewName A_Package.zip 2.     Make sure to repla...