We're completing the final steps of an upgrade from Web 8.5 to Sites 9 and from DXA 2.0 to 2.1. Most of the steps have succeeded so far (upgrading databases, upgrading CM and CD to Sites 9, etc.) - following the documentation here and here. We've come to the point when it is time to upgrade DXA on the Content Manager by running an import PowerShell command. However, when we run the import command, as per the documentation, we get an error message saying:
[Error] Tridion.ContentManager.InvalidActionException: Property 'TemplatePurpose' can not be updated
PS C:\install\SDL.DXA.NET.2.1\SDL.DXA.NET.2.1.0\cms> .\cms-import.ps1 -importType master-only -cmsUrl "http://localhost/
"
Installed CMS version reported to be 9.0.0.609
Copied 'C:\install\SDL.DXA.NET.2.1\SDL.DXA.NET.2.1.0\cms\DXA Application Data Definition.xml' to 'C:\Program Files (x86)
\SDL Web\config\ImportExport\ApplicationData'
Preparing upgrade to DXA 1.6 structure...
Folder '/webdav/100%20Master/Building%20Blocks/Framework' already exists; it seems that your CMS already has DXA 1.6 str
ucture.
Specify the -force flag if you want the run the upgrade anyways.
checking /webdav/100%20Master/Building%20Blocks/Framework/Developer/Templates/DXA%2EUpgrade
Folder '/webdav/100%20Master/Building%20Blocks/Framework/Developer/Templates/DXA%2EUpgrade' already exists; it seems tha
t your CMS already has DXA 2.0 structure.
Specify the -force flag if you want the run the upgrade anyways.
Uploading package 'C:\install\SDL.DXA.NET.2.1\SDL.DXA.NET.2.1.0\cms\master-only.zip' ...
Importing content ...
Aborted
2018/12/11 23:59:07 <141> [Information] Import process '7ae73a7a0c3345b4b8c4b7c3c185e869' is started by 'KCPS\djewett' a
t 12/11/2018 11:59:07 PM.
2018/12/11 23:59:07 <141> [Information] Building list of items to import and determining required import actions.
2018/12/11 23:59:07 <141> [Information] Unzipping and initializing package for import.
2018/12/11 23:59:11 <141> [Information] Import items into publication '000 Empty' started at 12/11/2018 11:59:11 PM.
2018/12/11 23:59:11 <141> [Information] Import items into publication '100 Master' started at 12/11/2018 11:59:11 PM.
2018/12/11 23:59:12 <141> [Error] Tridion.ContentManager.InvalidActionException: Property 'TemplatePurpose' can not be u
pdated
at Tridion.ContentManager.CommunicationManagement.TemplateBuildingBlock.OnSaving(SaveEventArgs eventArgs)
at Tridion.ContentManager.IdentifiableObject.Save(SaveEventArgs eventArgs)
at Tridion.ContentManager.ContentManagement.VersionedItem.Save(Boolean checkInAfterSave)
at Tridion.ContentManager.ImportExport.ImportAction.<>c__DisplayClass30_0.<SaveItem>b__0(Boolean isRetry)
at Tridion.ContentManager.ImportExport.Process.<>c__DisplayClass35_0.<InvokeInErrorHandler>b__0(Boolean isRetry)
at Tridion.ContentManager.ImportExport.AbortErrorHandler.Invoke[T](Func`2 function, LocalizableMessage message, Boole
an retryAvailable, Boolean isCritical, UserReply additionalUserReplyOptions)
at Tridion.ContentManager.ImportExport.Process.InvokeInErrorHandler[T](Func`2 function, LocalizableMessage message, B
oolean retryAvailable, Boolean isCritical)
at Tridion.ContentManager.ImportExport.ImportAction.SaveItem(IdentifiableObject item, IdentifiableObjectData deltaObj
ect)
at Tridion.ContentManager.ImportExport.UpdateImportAction.Perform(IdentifiableObjectData itemData)
at Tridion.ContentManager.ImportExport.Importer.ImportItem(WebDavUrl exportUrl, IList`1 dependentItemsChain, Dictiona
ry`2 unresolvedDependencies, Boolean specialImport)
at Tridion.ContentManager.ImportExport.Importer.ImportItem(WebDavUrl exportUrl, IList`1 dependentItemsChain, Dictiona
ry`2 unresolvedDependencies, Boolean specialImport)
at Tridion.ContentManager.ImportExport.Importer.ImportItem(WebDavUrl exportUrl, IList`1 dependentItemsChain, Dictiona
ry`2 unresolvedDependencies, Boolean specialImport)
at Tridion.ContentManager.ImportExport.Importer.ImportItem(WebDavUrl exportUrl, IList`1 dependentItemsChain, Dictiona
ry`2 unresolvedDependencies, Boolean specialImport)
at Tridion.ContentManager.ImportExport.Importer.ImportItems(IList`1 items, Boolean specialGroupImport)
at Tridion.ContentManager.ImportExport.Importer.Import(String packageName)
2018/12/11 23:59:12 <141> [Information] Transactional import failed at 12/11/2018 11:59:12 PM. No changes were committed
to SDL Web Content Manager.
An error occured while importing 'C:\install\SDL.DXA.NET.2.1\SDL.DXA.NET.2.1.0\cms\master-only.zip'
At C:\install\SDL.DXA.NET.2.1\SDL.DXA.NET.2.1.0\ImportExport\ContentManagerUtils.ps1:422 char:9
+ throw "An error occured while importing '$packageFullPath'"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (An error occure...aster-only.zip':String) [], RuntimeException
+ FullyQualifiedErrorId : An error occured while importing 'C:\install\SDL.DXA.NET.2.1\SDL.DXA.NET.2.1.0\cms\maste
r-only.zip'
Some additional information:
After some investigation, it appears this property is a new property introduced to the CM database in Sites 9, as I see the column for it after having upgraded our CM database. And the DXA 2.1 import package also contains the field:
However, it seems that because the values currently in the CM database are all null, the import is blocked from overwriting existing rows. I can run a SQL statement to enumerate which templates have the null TemplatePurpose and which are likely the culprits:
It turns out, the templates causing the issue are all of the templates in the 100 Master/Building Blocks/Framework/Developer/Templates/DXA.Legacy and DXA.R2 folders: