Step by step guide to setup a new Sitecore Helix solution without Gulp
Habitat and Helix
Habitat is an example on how you can set up a Sitecore Helix solution. I have seen several projects using it as a starter.Habitat is not intended to be a starter solution, or as a recommendation of tools for your solutions. https://github.com/Sitecore/HabitatI created some notes and steps in notepad while setting up my first and second Helix project. I shared these notes with my team members and it has been used as a way to start new Helix solutions for our team.
Setup new Sitecore Helix Solution
1, Install siteFor Sitecore 8 use SIM.
For Sitecore 9 install site with install.ps1.
2. Create a new project in Visual Studio Online
3. Clone the project
4. Create empty solution
5. Add your Sitecore .gitignore
This is my starter .gitignore.
6. Add nuget.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<configuration> | |
<!-- | |
Used to specify the default Sources for list, install and update. | |
--> | |
<packageSources> | |
<add key="Nuget v2" value="https://www.nuget.org/api/v2" /> | |
<add key="Nuget v3" value="https://api.nuget.org/v3/index.json" /> | |
<add key="Sitecore v2" value="https://sitecore.myget.org/F/sc-packages/" /> | |
<add key="Sitecore v3" value="https://sitecore.myget.org/F/sc-packages/api/v3/index.json" /> | |
</packageSources> | |
<activePackageSource> | |
<!-- this tells that all of them are active --> | |
<add key="All" value="(Aggregate source)" /> | |
</activePackageSource> | |
<disabledPackageSources> | |
<add key="Sitecore v3" value="true" /> | |
</disabledPackageSources> | |
</configuration> |
These will be extended as the solution grows.
My starter node templates on GitHub.
Feature node template with Glass Mapper.
8. Add add-helix-module.configuation
This configuration has a few more configurations than the original created by Marc Duiker.
moduleFoundationTemplatePath, moduleFeatureTemplatePath and moduleProjectTemplatePath is used to have a unique node template for each of the add helix commands.
I explained this in a previous blog post.
sitecoreVersion was added to easier get the correct nuget packages for the current Sitecore version.
The current version of my add-helix-module.configuation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"__comment": "This configuration file is used by the add-helix-module.ps1 script which creates modules for Sitecore Helix solutions.", | |
"config": { | |
"__comment__moduleFoundationTemplatePath": "Update the moduleFoundationTemplatePath property to point to your module-template-Foundation location.", | |
"moduleFoundationTemplatePath": "module-template-foundation", | |
"__comment__moduleFeatureTemplatePath": "Update the moduleFoundationTemplatePath property to point to your module-template-Foundation location.", | |
"moduleFeatureTemplatePath": "module-template-feature", | |
"__comment__featureNamespacePrefix": "Replace the value for featureNamespacePrefix with a suitable namespace prefix. The Feature.<ModuleName> will be appended by the script.", | |
"moduleProjectTemplatePath": "module-template-project", | |
"__comment__projectNamespacePrefix": "Replace the value for projectNamespacePrefix with a suitable namespace prefix. The Feature.<ModuleName> will be appended by the script.", | |
"featureNamespacePrefix": "YOURPREFIX", | |
"__comment__foundationNamespacePrefix": "Replace the value for featureNamespacePrefix with a suitable namespace prefix. The Foundation.<ModuleName> will be appended by the script.", | |
"foundationNamespacePrefix": "YOURPREFIX", | |
"projectNamespacePrefix": "YOURPREFIX", | |
"__comment__sourceFolderName": "The sourcefolder should contain the relative path (from the sln file folder) where the Feature, Foundation and Project folders are located. The Sitecore Habitat default is '\\src'.", | |
"sourceFolderName": "\\src", | |
"__comment__fileExtensionsToUpdateContentRegex": "The regex in the fileExtensionsToUpdateContentRegex property is used to find the files which contain tokens which will be replaced with new values by the script.", | |
"fileExtensionsToUpdateContentRegex": "(.config|.csproj|.cs|.cshtml|.feature|.js|.nuspec|.role|.sitecore|.targets)$", | |
"__comment__fileExtensionsToUpdateProjectGuidsRegex": "The regex in the fileExtensionsToUpdateProjectGuidsRegex property is used to find the files which need to have VS project GUIDs inserted.", | |
"fileExtensionsToUpdateProjectGuidsRegex": "(.csproj|AssemblyInfo.cs)$", | |
"__comment__": "The templateNamespacePrefix property contains the token which will be replaced with the value from either featureNamespacePrefix or foundationNamespacePrefix.", | |
"templateNamespacePrefix": "_NamespacePrefix_", | |
"__comment__templateModuleType": "The templateModuleType property contains the token variable which will be replaced with Feature or Foundation.", | |
"templateModuleType": "_ModuleType_", | |
"__comment__templateModuleName": "The templateModuleName property contains the token which will be replace with the actual ModuleName.", | |
"templateModuleName": "_Name_", | |
"__comment__templateProjectGuid": "The templateProjectGuid property contains the token which will be replaced by a new GUID and used as VS module project identifier.", | |
"templateProjectGuid": "_ProjectGuid_", | |
"__comment__templateTestProjectGuid": "The templateTestProjectGuid property contains the token which will be replaced by a new GUID and used as VS test project identifier.", | |
"templateTestProjectGuid": "_TestProjectGuid_", | |
"__comment__templateSitecoreVersion": "Template Sitecore version", | |
"templateSitecoreVersion": "_SitecoreVersion_", | |
"__comment__sitecoreVersion": "Sitecore version", | |
"sitecoreVersion": "9.0.180604" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<packages> | |
<!--Default--> | |
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net47" /> | |
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net47" /> | |
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net47" /> | |
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.7" targetFramework="net47" /> | |
<package id="Microsoft.Net.Compilers" version="2.1.0" targetFramework="net47" developmentDependency="true" /> | |
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net47" /> | |
<!--Sitecore--> | |
<package id="Sitecore.Analytics.NoReferences" version="_SitecoreVersion_" targetFramework="net47" developmentDependency="true" /> | |
<package id="Sitecore.ContentSearch.NoReferences" version="_SitecoreVersion_" targetFramework="net47" developmentDependency="true" /> | |
<package id="Sitecore.Kernel.NoReferences" version="_SitecoreVersion_" targetFramework="net47" developmentDependency="true" /> | |
<package id="Sitecore.Mvc.NoReferences" version="_SitecoreVersion_" targetFramework="net47" developmentDependency="true" /> | |
<package id="Sitecore.Speak.Client.NoReferences" version="_SitecoreVersion_" targetFramework="net47" developmentDependency="true" /> | |
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Reference Include="Sitecore.ContentSearch, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL"> | |
<HintPath>..\..\..\..\packages\Sitecore.ContentSearch.NoReferences._SitecoreVersion_\lib\NET462\Sitecore.ContentSearch.dll</HintPath> | |
<Private>True</Private> | |
</Reference> | |
<Reference Include="Sitecore.Kernel, Version=11.1.0.0, Culture=neutral, processorArchitecture=MSIL"> | |
<HintPath>..\..\..\..\packages\Sitecore.Kernel.NoReferences._SitecoreVersion_\lib\NET462\Sitecore.Kernel.dll</HintPath> | |
<Private>True</Private> | |
</Reference> | |
<Reference Include="Sitecore.Mvc, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL"> | |
<HintPath>..\..\..\..\packages\Sitecore.Mvc.NoReferences._SitecoreVersion_\lib\NET462\Sitecore.Mvc.dll</HintPath> | |
<Private>True</Private> | |
</Reference> | |
<Reference Include="Sitecore.Speak.Client, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL"> | |
<HintPath>..\..\..\..\packages\Sitecore.Speak.Client.NoReferences._SitecoreVersion_\lib\NET462\Sitecore.Speak.Client.dll</HintPath> | |
<Private>True</Private> | |
</Reference> |
This configuration is used in the Build and deploy PowerShell script created by my team member.
With this we can build and deploy Helix solutions without Gulp.
We can now run these commands in the console:
- build-and-deploy
- build-and-deploy unicorn
- unicorn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"__comment": "This configuration file is used by build-and-deploy.ps1. Type 'build-and-deploy' in package manage console. To run unicorn: 'build-and-deploy unicorn' or 'unicorn'", | |
"config": { | |
"__comment": "script will look for your msbuild.exe in visualstudio 2017 default path. msBuildExe is a optional fallback value if no msbuild.exe is found", | |
"msBuildExe": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\MSBuild\\15.0\\Bin\\msbuild.exe", | |
"unicornScript": "src\\Foundation\\Serialization\\code\\UnicornSync\\UnicornSync.ps1", | |
"appPoolName": "dev.yourapppoolname.com", | |
"siteUrl": "dev.yoursitename.com", | |
"nugetRestore": true | |
} | |
} |
This is a helper for the local publish profile. The local publish profile is created for each of the projects based on the module templates.
Your structure should look something like this now
GitHub
My GitHub with the starter filesAdditional notes
I recommend to start every new Sitecore Helix solution from scratchI will later create blog posts on how to add Unicorn(serialization), and GlassMapper to this "empty" solution
Comments