11

Looking at Sitecore Habitat, each Visual Studio project is in a folder named 'code'. In Visual Studio, by default this folder is named the same as the project. I can rename this folder, but I have to jump through some hoops (remove the project from the solution, rename the folder, re-add the project to the solution... Plus maybe some source control shenanigans). Is there a simpler way to do this? Helix has a lot of projects... Some settings? Do I need a custom vsix?

5

When adding a new project, simply create the project "code", and then rename the project and namespace to your preferred name.

Check out the following workshop video:

https://youtu.be/4lC-SdYh4Xg?list=PL1jJVFm_lGnz0XzXU5uNJSgTGMxNFsOky

The Yeoman generators are great for setting up additional parts like the .config, TDS, unit tests etc.

https://www.npmjs.com/package/generator-prodigious-helix

  • I can do that without unloading the project? That seems like the easiest solution. – Ethan Schofer Oct 19 '16 at 12:59
  • 1
    Yes. And keep in mind - you only create projects very rarely. By defining a uniform convention like the /code folder you can more easily target projects in scripts and generally in DevOps – Eldblom Oct 19 '16 at 22:17
  • I was trying to learn how to build up a project from scratch, as a way to understand Helix. So in that case I would be creating many projects. – Ethan Schofer Oct 19 '16 at 22:28
  • 1
    Yes, once :) The ambition of Helix is long term productivity – Eldblom Oct 19 '16 at 22:33
6

You probably could, but it'd be a lot of - in my opinion - unnecessary work.

The code folder is used and referenced in the gulp scripts. Like here, for instance:

gulp.task("06-Deploy-Transforms", function () {
  return gulp.src("./src/**/code/**/*.transform")
      .pipe(gulp.dest(config.websiteRoot + "/temp/transforms"));
});

And here:

gulp.task("Copy-Local-Assemblies", function () {
  console.log("Copying site assemblies to all local projects");
  var files = config.sitecoreLibraries + "/**/*";

  var root = "./src";
  var projects = root + "/**/code/bin";
  return gulp.src(projects, { base: root })
    .pipe(foreach(function (stream, file) {
      console.log("copying to " + file.path);
      gulp.src(files)
        .pipe(gulp.dest(file.path));
      return stream;
    }));
});

If you were to change the directory name structure, you would need to go in and adopt this file to any new naming scheme you come up with. If you named the folders uniquely, you would not be able to wildcard the task as it is done here.

That said; Habitat is just a reference project. I don't think there's anything in Helix that dictates this particular structure. You are free to set up your own, but you will need to find solutions to easy scripting and building yourself.

If you're interested; Kam Figy has been experimenting with some Yeoman scripts to easily add features and projects and so on to a Helix-like solution. They could serve as a starting point for your own setup.

Link: Generator Habitat (not up to date)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.