We're using uSync.Complete v8.9.3 and our current workflow is like this:
We deploy the files to the target server
Using uSync Exporter, we manually create a sync-pack for the document types we want to update, checking Dependencies, Children, and Ancestors, and import it on the target server
Everything works as expected, except for templates. If a docType has a new template, it fails to import the template with the message "Cannot find Template".
I understand the templates exist on disk, but not on Umbraco database. We then have to manually add the template in Umbraco Backoffice and change the allowed / default templates of the imported docTypes.
If I check the "Include template files" checkbox, the *.cshtml files from the /Views folder are included, but they're not added to the DB.
I was under impression that uSync has the ability to add the templates reference to the DB, provided they exist on the disk. Is this true? If so, what am I doing wrong?
Yes that should work, only really seen issues if the templates folder has been moved somehow.
I would recommend you update to the latest version and see if that helps. because with v8.10+ you can actually pick templates in the exporter and it will include them individually just like we do doc-types.
I upgraded to the latest 8.x uSync version, but it turns out the templateHandler for the exporter was not enabled in my uSync.config. With the handler enabled the templates are correctly restored, as long as I include them when creating the sync-pack.
When templates are not included, it fails to find the referenced templates, although they exist on the server.
My incorrect assumption was that when importing a sync-pack containing only docTypes and dataTypes uSync would try to find missing templates referenced by the docType in the server /views folder, looking for *.cshtml files with a name that matched the template alias.
I guess I was expecting that when docType dependencies are included the template xml would also be exported to the sync-pack.
So the only option is to include the templates, but that also means folders /views, /scripts and /css will be overwritten with the ones from the sync-pack, right? Even if they're unrelated to the exported docType.
yeah your right, the templates (and the files) don't get included in the sync pack unless the include templates button is clicked and then everything (views, css, scripts) is included.
I think we did it this way because we are not doing dependency checking within the code, so we don't for example know if the template file requires a certain set of partial views, or indeed if there are also scripts and css files that will be needed for the template to work. So we went everything or nothing.
With the current release I think we can be a little more nuanced than that, we still don't do code dependency checking but with the advent of the file sync items we decided it wasn't our call to make, so we have been putting warning around file syncs along the lines of , you have to make sure you know what other code files are required.
This is something we should extend to Exporter, we will take a look at making this more granular for the next release.
Exporter Sync-Pack and templates
Hi!
We're using uSync.Complete v8.9.3 and our current workflow is like this:
We deploy the files to the target server
Using uSync Exporter, we manually create a sync-pack for the document types we want to update, checking Dependencies, Children, and Ancestors, and import it on the target server
Everything works as expected, except for templates. If a docType has a new template, it fails to import the template with the message "Cannot find Template".
I understand the templates exist on disk, but not on Umbraco database. We then have to manually add the template in Umbraco Backoffice and change the allowed / default templates of the imported docTypes.
If I check the "Include template files" checkbox, the *.cshtml files from the /Views folder are included, but they're not added to the DB.
I was under impression that uSync has the ability to add the templates reference to the DB, provided they exist on the disk. Is this true? If so, what am I doing wrong?
Hi Luis,
Yes that should work, only really seen issues if the templates folder has been moved somehow.
I would recommend you update to the latest version and see if that helps. because with v8.10+ you can actually pick templates in the exporter and it will include them individually just like we do doc-types.
Kevin
Hi Kevin, thanks for the quick answer.
I upgraded to the latest 8.x uSync version, but it turns out the templateHandler for the exporter was not enabled in my uSync.config. With the handler enabled the templates are correctly restored, as long as I include them when creating the sync-pack.
When templates are not included, it fails to find the referenced templates, although they exist on the server.
My incorrect assumption was that when importing a sync-pack containing only docTypes and dataTypes uSync would try to find missing templates referenced by the docType in the server /views folder, looking for *.cshtml files with a name that matched the template alias.
I guess I was expecting that when docType dependencies are included the template xml would also be exported to the sync-pack.
So the only option is to include the templates, but that also means folders /views, /scripts and /css will be overwritten with the ones from the sync-pack, right? Even if they're unrelated to the exported docType.
Hi Luis,
yeah your right, the templates (and the files) don't get included in the sync pack unless the include templates button is clicked and then everything (views, css, scripts) is included.
I think we did it this way because we are not doing dependency checking within the code, so we don't for example know if the template file requires a certain set of partial views, or indeed if there are also scripts and css files that will be needed for the template to work. So we went everything or nothing.
With the current release I think we can be a little more nuanced than that, we still don't do code dependency checking but with the advent of the file sync items we decided it wasn't our call to make, so we have been putting warning around file syncs along the lines of , you have to make sure you know what other code files are required.
This is something we should extend to Exporter, we will take a look at making this more granular for the next release.
is working on a reply...