We currently have a Visual Studio solution with two projects: one for our main site, using Web forms, and one for utilities, which is currently Extension methods on Item. (The latter project has been in the queue to migrate to a NuGet package on our local NuGet server.)
Running Sitecore 8.1.160519.
- Add solution folders to the existing project.
- Configuration
- Feature
- Foundation
- Project
- In repo root, add a src folder.
- In new src folder create the Helix structure.
- Feature
- Foundation
- Project
- Add necessary Foundation Sitecore items
- All icons should be set to Applications/32x32/folder_gear.png
- In /master/sitecore/layout/Layouts create a new Layout Folder item called Foundation.
- In /master/sitecore/system/Settings create a new Folder item called Foundation.
- In /master/sitecore/templates create a new Template Folder item called Foundation.
- Add necessary Project Sitecore items
- All icons should be set to Applications/32x32/folder_window.png
- In /master/sitecore/layout/Layouts create a new Layout Folder item called Project.
- In /master/sitecore/layout/Renderings create a new Rendering Folder item called Project.
- In /master/sitecore/layout/Placeholder Settings create a new Folder item called Project.
- In /master/sitecore/system/Settings create a new Folder item called Project.
- In /master/sitecore/templates create a new Template Folder item called Project.
- Add necessary Feature Sitecore items
- All icons should be set to Applications/32x32/folder_cubes.png
- In /master/sitecore/templates create a new Template Folder item called Feature.
- In /master/sitecore/layout/Renderings create a new Rendering Folder item called Feature.
- In /master/sitecore/system/Settings create a new Folder item called Feature.
- In /master/sitecore/templates create a new Template Folder item called Feature.
- Create a new Solution Folder in VS under Project. Name it whatever makes sense for your organization. In our case we called it 'WsbMain' as it was for our main wsb.wisc.edu site.
- Add a new ASP.NET Web Application project to the Solution Folder.
- Give it the name code
- Browse to the src\Project directory and create a new directory matching the Solution Folder name from step 1. In our case, 'WsbMain.'
- Select that newly created directory for the Project Location.
- Select an Empty ASP.NET 4.6 Template, and Add folders and core references for MVC.
- Once the project has been created, rename the Project from 'code' to Xxx.Project.Yyy where 'Xxx' is your organization and 'Yyy' is the Project name from step 1. In our case, Wsb.Project.WsbMain.
- Go into the Project properties (right click on the Project and select Properties) and update the Assembly name and Default namespace according to step 2.5 ('Wsb.Project.WsbMain' in our case).
- Set the Build Action on the Web.config file to None.
- Delete the following directories:
- App_Data
- App_Start
- Delete the following files:
- Global.asax
- Create the following config files (and directories):
-
App_Config\Include\Project\Wsb.Project.WsbMain.config
<?xml version="1.0"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> </sitecore> </configuration>
-
App_Config\Include\Project\Wsb.Project.WsbMain.Serialization.config
<?xml version="1.0"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <unicorn> </unicorn> </sitecore> </configuration>
-
- Update
AssemblyVersion
in AssemblyInfo.cs to[assembly: AssemblyVersion("1.0.*")]
. - Add the following NuGet packages from the official Sitecore NuGet instance.
- Sitecore.Kernel.NoReferences
- Sitecore.Mvc.Analytics.NoReferences
- Sitecore.Mvc.NoReferences
- Create a new publishing profile, pointing to where ever you'll be publishing the files to.
- In our case we're publishing to the File System, at C:\inetpub\wwwroot\scdev.Publish, making sure that no options are selected for File Publish Options.
- Make sure you manually add this to Git if you're using the standard VS .gitignore file, if the settings should be shared.
- In the Views directory, create a new folder name based upon step 1. In our case, WsbMain.
- Create a new directory within the directory created in step 13 called Layouts.
- So in our example, the structure under the solution looks like Project\WsbMain\Wsb.Project.WsbMain\Views\WsbMain\Layouts
- Create a new MVC View Page within the new Layouts directory. Title it whatever makes sense.
- In our case we called it Default to match the Habitat example site.
- Populate Default.cshtml with the necessary code for your layout.
- Add a new Layout item in Sitecore matching the name from step 16. In our case Default.
- Set the Path to the Web root path to the view.
- In our case /Views/WsbMain/Layouts/Default.cshtml
- If you're not sure, publish the project and then browse to it in the file system.
- Add the layout to an item and test.
Pretty much the same as adding a new Project, but with the following changes:
- Instead of _.Project._, use _.Feature._.
- The following NuGet package should not be necessary:
- Sitecore.Mvc.Analytics.NoReferences
- When creating the directory structure in the Views folder, you can use the name of the feature as the child folder, which should also generally match the Razor View file name.
- For example: /Views/PageText/PageText.cshtml
- Current layout uses inline custom controls for certain elements.
- Current layout includes standard .NET placeholders, for widgets to inject CSS, JS, and off canvas forms.
Unicorn sync:
Deployment: