Habi what-a-tat ? Create a Sitecore Helix solution from scratch using PowerShell

This post is all about creating a Helix based solution from scratch. Please watch the video for additional information and a demo of the script. I really discourage people from using Habitat as the base to create new solutions. Hopefully this script will help.

Also refer to Marc Duiker’s Hands-on with Sitecore Helix: Anatomy of the Add-HelixModule.ps1 PowerShell script.

So in order to create a Helix solution from scratch, we do not have any tool at this moment. We either manually build it or use Habitat as a base. I do not recommend using Habitat and modifying that solution to fit your needs.

To start of with, the best way to automate this is to use PowerShell scripts inside of the Visual Studio IDE via the Package Manager Console. We need to use DTE (EnvDTE).

Download the HabitatSolutionScript.ps1 from https://gist.github.com/akshaysura/184132f67decb749ae235b602351832c

Open Visual Studio IDE

Open Package Manager Console

Type in $profile

Open that location in Windows explorer. You might not have NuGet_profile.ps1 at that location. Create one.

Open the NuGet_profile.ps1 and insert the following line and modify the path to your HabitatSolutionScript.ps1

. “D:\Projects\PowerShell\HabitatSolutionScript.ps1”

Save and close NuGet_profile.ps1

Restart your Visual Studio IDE and open Package Manager Console

Type in let and tab or you could type in the whole command Lets-Rumble

Follow the on screen prompts and enjoy your solution. I would recommend watching the video for additional information.

The script is not tested so please use it at your own risk. Since it required an empty folder, it won’t affect your existing code/solutions.

 

 

Please contribute to this script and hopefully we can make it better for the entire community.

If you have any questions or concerns, please get in touch with me. (@akshaysura13 on twitter or on Slack).

10 comments

  • Hetal 11 months ago

    Nice one Akshay!!! Thanks for sharing!!!

  • Prasad 11 months ago

    Hi Akshay,

    Please update the command name in Article from “Lets_Rumble” to “Lets-Rumble”. It seems a typo.

  • akshaysuraadmin 11 months ago

    Updated. Thank you.

  • Mohamed Krimi 11 months ago

    Ho Akshay very nice script!! next step integrate with Sitecore Rocks to generate Data templates and rendering and it will rocks 🙂

  • Rayo 8 months ago

    Hi Akshay, I have followed your instruction above, but i have an issue ‘Lets-Rumble’ is not recognized as the name of a cmdlet. i have followed instruction from https://nshackblog.wordpress.com/tag/powershell/ but the error still same. any advice?

  • akshaysuraadmin 8 months ago

    It sounds like its not registering with in your Visual Studio. I wouldn’t know unless I troubleshoot it.

  • Jeff Stoll 7 months ago

    Anyone using VS 2017 can use these paths to update the script
    $global:classTemplate = “C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\ProjectTemplates\CSharp\Windows\1033\ClassLibrary\csClassLibrary.vstemplate”
    $global:webTemplate = “C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\ProjectTemplates\CSharp\Web\1033\WebApplicationProject40\EmptyWebApplicationProject40.vstemplate”

  • Mayank 7 months ago

    @Rayo you might have missed a dot “.”
    Open the NuGet_profile.ps1 and insert the following line and modify the path to your HabitatSolutionScript.ps1

    . “D:\Projects\PowerShell\HabitatSolutionScript.ps1”

  • Swati 7 months ago

    I am getting this error “Lets-Rumble : The term ‘Lets-Rumble’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again”. I tried to troubleshoot as suggested here https://nshackblog.wordpress.com/tag/powershell/ but still it is not working

  • akshaysuraadmin 6 months ago

    Thank you for the comment. Please make sure you follow the process of adding the scripts at the right location. Most of the time the issue is how they are installed. Thanks.

Add your comment

Your email address will not be published.