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:
- Open Windows File Explorer and navigate to c:/projects/sitecore.demo.group
- Create the following folder structure: /src/Feature/Events
- Open Visual Studio 2017
- Open the Habitat Group website solution from c:/projects/sitecore.demo.group
- Create a Solution folder in the root named “Feature”
- Create a Solution folder in “Feature” named “Events”
- Create a new Visual Studio Project in the “Events” folder:
- Use the “ASP.NET Web Application” template
- Location should be “C:\Projects\Sitecore.Demo.Group\src\Feature\Events”
- Name should be “code” as this will create the correct folder structure. We'll rename the project in the next step.
- On the next screen, choose the “Empty” template and check the “MVC folders” checkbox
- Set the properties for the new project
- Rename the project to “Sitecore.Feature.Events”
- In the project properties set the assembly name and namespace to “Sitecore.Feature.Events”
- Update the project to .NET Framework 4.6.2
- Delete the App_Data, App_Start and Global.asax files and folders
- Ensure the web.config is not published with the project
- Open properties for the web.config and /views/web.config files
- Set “Build Action” to “None”
- Add configuration files
- Under App_Config/Include, create a folder named “Feature”.
- Add Sitecore Kernel NuGet reference
- Right-click the project and select "Manage NuGet Packages"
- Change package source to the Sitecore NuGet feed
- Click Browse
- Find and install Sitecore.Kernel.NoReferences, and select version 9.0.180604
- Find and install Sitecore.Mvc.NoReferences, and select version 9.0.180604
- Set publish options
- Copy the “/Properties/PublishProfiles” folder from the Project/Sitecore.Demo.Group project into the same place in the Sitecore.Feature.Events project
- Publish the project (note -- we're using Gulp in this workshop to do publishing and deployment, not Web Deploy)
- Save the Visual Studio solution
- 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.
Added new post here:
ReplyDeletehttps://ramalingareddymareddy.blogspot.com/2021/05/visual-studio-project-template-for.html