Multiple versions of the Sitecore Install Framework

So last week, I tried to install some SOLR cores by using the SIF framework for a 9.0.2 installation of Sitecore.

Unfortunately, I kept getting an error while executing my install scripts (both xconnect-solr.json and sitecore-solr.json configurations).

Since Sitecore 9.1 was released, a new version of the SIF module (version 2.0) was also made available. And I just used the easy way to install SIF as is mentioned on the doc.sitecore.net guidance page.

Install-Module -Name SitecoreInstallFramework -Repository SitecoreGallery

But that installs the new Sitecore SIF 2.0 version, while that one isn't really made for Sitecore 9.0.2.

Solution

Force PowerShell to use an older version of the SitecoreInstallFramework

I first used the easy solution and just changed the configuration file. But I was curious how I could use PowerShell to force it to use a different version.

#List all version
Find-Module -Name SitecoreInstallFramework -AllVersions

#Install the latest version
Install-Module -Name SitecoreInstallFramework -Repository SitecoreGallery

#Install a specific version
Install-Module -Name SitecoreInstallFramework -Repository SitecoreGallery -RequiredVersion 1.2.1

#Verify mulitple versions have been installed
Get-InstalledModule -Name SitecoreInstallFramework -AllVersions

Now multiple versions of the SitecoreInstallFramework have been installed and are available to be used. But by default the most recent one is loaded into your PowerShell session!
So executing any commands (like Install-SitecoreConfiguration) will still happen with the most recent version!

#List the version that is currently in use for the SitecoreInstallFramework
Get-Command -Module SitecoreInstallFramework | Select-Object -Property name, version

Switching versions

I started to do some more research and apparently the information from this blog post is already described in the 'Sitecore Installation Configuration Guide' of the 2.0.0 version... derp

Force PowerShell session to use the version you need:

Remove-Module -Name SitecoreInstallFramework
Import-Module -Name SitecoreInstallFramework -RequiredVersion 1.2.1

If you now run the Get-Command again to check the version, you'll be using 1.2.1!

Notes to self in future

  • Always check the most recent Sitecore documentation for tools that they provide
  • Always use the right SIF version for the Sitecore you want to install
Sitecore XP Version SIF Version
9.0.x 1.2.1
9.1 2.0.0

The error I got when trying to install SOLR with SIF 2.0 for Sitecore 9.0.2

The sitecore-solr.json and xconnect-solr.json files both have the method 'CreateCores'.
Those specify which cores need to be added. Each core has a "Name" argument.

And this was the PowerShell error I saw:

Invoke-ManageSolrCoreTask : Cannot process argument transformation on parameter
'Exception'. Cannot convert the "Microsoft.PowerShell.Commands.HttpResponseExcep
tion: Response status code does not indicate success: 400 (Bad Request).
   at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(Error
Record errorRecord)" value of type "Microsoft.PowerShell.Commands.HttpResponseEx
ception" to type "System.Net.WebException".
At C:\Program Files\PowerShell\Modules\SitecoreInstallFramework\2.0.0\Public\Ins
tall-SitecoreConfiguration.ps1:641 char:25
+                         & $entry.Task.Command @paramSet | Out-Default
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invo
ke-ManageSolrCoreTask

The CreateCores task will call the SOLR CoreAdmin API to create the cores.
Apparently the 'name' definition needs to be lowercase to work with SIF 2.0 & the CoreAdmin API. No problems with Sitecore 9.1 json files: