0

I face an issue while setup Habitat 1.8.1 on Sitecore 9.2

I'm using Visual Studio 2019 installed in 'D' drive, not in 'C' drive, node 10.18.0, gulp CLI version: 2.3.0, gulp Local version: 3.9.1.

I noticed that code try to use MSBuild from the "C" drive maybe this is an old installation, but new visual studio 2019 and MSBuild installed in "D" drive.

build error

0

After a lot of tries i had to uninstall visual studio from "D" and remove MSBuild from 'Registry Editor' in this location "Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild" and install visual studio again in "C" Drive , which leaded to a new KEY add in the Registry with the correct path of MSBuild

0

The easiest solution is to add VS installation path to your system environment variables under the name of vsInstallDir( No need to uninstall VS and reinstall on Drive C)

Configuring Environment Variables

0

Habitat Gulp build script is using gulp-msbuild plugin to create the msbuild cmd. Behind the scene, if you look within gulp-msbuild in your node-modules or in the official repos here, you can find the msbuild-finder code where you will also find hardcoded path to where it looks for msbuild (C:/)

// Line 247,      
  let pathRoot = process.env["ProgramFiles"] || "C:/Program Files";
  if (hostIs64Bit) {
      pathRoot = process.env["ProgramFiles(x86)"] || "C:/Program Files (x86)";
  }
  let msbuildRoot = pathRoot;
  let toolsVersion = parseFloat(options.toolsVersion);
// ...

So you could console.log() within that file and have a better understanding of what is happening.

Also note that this plugin was blacklisted in the official gulp plugin directory. Can use the msbuild plugin instead which would lead you to the exact same issue because it is also looking at C:/ by default. You can define what msbuild version to use with the version switch, but would only lead to the local path to msbuild within the C: drive.

Side note : I think it is more flexible to create an msbuild cmd and easier since you can add any of the offical msbuild switch (doc here) as an override param. Could end up with something similar to

var overrideParams = [];
overrideParams.push(`/t:${targets}`,
    `/v:${config.solution.buildVerbosity}`,
    '/nologo',
    `/m:${config.solution.buildMaxCpuCount}`,
    '/nr:False',
    `/p:Configuration=${config.solution.buildConfiguration}`,
    `/p:Platform=${config.solution.buildPlatform}`,
    '/p:DeployOnBuild=true',
    '/p:DeployDefaultTarget=WebPublish',
    '/p:WebPublishMethod=FileSystem',
    '/p:DeleteExistingFiles=false',
    `/p:publishUrl=${dest}`,
    '/p:_FindDependencies=true');

msbuild.sourcePath = filePath;
msbuild.config('overrideParams', overrideParams);
msbuild.version = `${config.solution.buildToolsVersion}`;
msbuild.build();

So long story short, Gulp's msbuild plugins are not taking into consideration VStudio being installed anywhere but on C: drive.

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.