Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matt 359 posts 842 karma points
    Oct 31, 2018 @ 14:35
    Matt
    0

    Usync Export and Import on command line

    Hello all,

    I've been testing out uSync and loving what I can see so far, makes things so much easier when moving content/files across environments.

    I have the following setup;

    UmbracoSiteA

    -uSync installed

    -uSync Content Installed

    UmbracoSiteb

    -uSync installed

    -uSync Content Installed

    I've also created a batch file which copies;

    Media, Scripts, uSync, Views and CSS folders across from SiteA to SiteB

    My issue is now, I'm looking to run a command line from SiteA which will run the uSync export

    I will then run my batch file.

    Then if possible, have a command line to Import Usync on siteB

    I found the following thread about uSync.Chauffeur

    https://our.umbraco.com/packages/developer-tools/usync/usync/81793-executing-import-on-umbraco-site-from-program

    However I didn't quite understand how this works? Could someone point me in right direction how I can run the Usync export and import via command line?

    Thanks in advance,

    Matt

  • Kevin Jump 2348 posts 14896 karma points MVP 8x c-trib
    Oct 31, 2018 @ 15:19
    Kevin Jump
    100

    Hi,

    So, if you install both the Chauffeur.Runner (https://www.nuget.org/packages/Chauffeur.Runner/) and and uSync.Chauffeur (https://www.nuget.org/packages/uSync.Chauffeur/) packages installed

    Then you can run chauffeur from a command line in your projects bin folder. (see https://aaronpowell.github.io/Chauffeur/getting-started.html)

    > bin/Chauffeur.Runner.exe
    

    From here you get an umbraco> command prompt

    if you type help you should get a list of available commands (including uSync if you've installed it)

    equally help uSync will give you more detail of what uSync commands you have/

    In general usync commands are in the format uSync [action] [folder]

    the folder is optional and allows you to use something that isn't usync/data

    so an export to the standard folder is :

    Umbraco> uSync export 
    

    and standard folder import is

    Umbraco> uSync Import
    

    You can be more specific if you want - for example only import content-types might be

    Umbraco > uSync content-type import [somefolder/path]
    

    You can call chauffeur and have it run the command in one, so for example

    > bin\chauffeur.runner usync export 
    

    Will start up chauffeur, run a uSync export to the default folder and exit. (you don't need to do this if uSync is already exporting everything when you make changes) and

    > bin\chauffeur.runner usync import 
    

    Will do the import (which might be all you want/need to import to your second site)

    When Importing on the command line you should turn off import at startup in the usync config (config/usyncBackoffice.config) - set import to false (<Import>false</Import>) because you don't need it and it will slow boot times down.

    It is worth noting there is a difference between the built-in chauffeur content-type (and other) commands and the uSync content-type commands, they have different format files and do things differently.

    Kevin

  • Matt 359 posts 842 karma points
    Nov 05, 2018 @ 13:37
    Matt
    0

    Hello Kevin,

    Thanks for the reply.

    I tried to install the uSync Chauffeur and I'm getting the following error;

    Installing uSync.Chauffeur 1.0.0.
    Install failed. Rolling back...
    Package 'uSync.Chauffeur.1.0.0 : Chauffeur.Runner [1.3.0, ), uSync [4.0.5, )' does not exist in project 'UmbracoSiteA'
    Package 'uSync.Chauffeur.1.0.0 : Chauffeur.Runner [1.3.0, ), uSync [4.0.5, )' does not exist in folder 'UmbracoSiteA\packages'
    Executing nuget actions took 743.85 ms
    Install-Package : Could not install package 'uSync.Chauffeur 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any 
    assembly references or content files that are compatible with that framework. For more information, contact the package author.
    At line:1 char:1
    + Install-Package uSync.Chauffeur -Version 1.0.0
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
        + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies