3

How to publish only the serialized items using the Sitecore CLI command.

I have configured the Module files path in the sitecore.json file.

When I run dotnet sitecore publish, i guess it is trying to publish the whole site.

So, in order to publish only the serialized items, I have tried this command which gives an error.

dotnet sitecore publish --config .\sitecore.json

The sitecore.json file is in the project's root folder. So the path is correct. The pull & push commands are working fine.

enter image description here

Update 1:

When I execute dotnet sitecore publish --config .\ it says started and there is no progress for almost 30 mins and it then shows this error.

enter image description here

Update 2:

My sitecore.json file is in the root directory. Yet I have provided the path. There is no progress. It just says publish started. After 10 mins I have to do a CTRL + C to stop it.

enter image description here

Could it be because, how I have named my module files.

enter image description here

enter image description here

3 Answers 3

2

I think your issue is the way you are adding the --config parameter, you should add the path to the folder containing sitecore.json, rather than the file itself.

Please try this instead:

dotnet sitecore publish --config .\

If you see below, I tried the same command as you did first. It gives same errors (basically saying it doesnt recognise the command as publish plugin not referenced).

The second try rerences the folder and a publish starts.

Sitecore Publish

4
  • It isn't working. It says publish started but there is no update on screen. Not sure if it publishing the whole site again. No update on pressing enter, esc or minimizing the powershell console.
    – sukesh
    Dec 23, 2022 at 12:13
  • Assuming your serialised items are in folder called YOURFOLDER in root. Try calling this command when in root. dotnet sitecore publish --config .\YOURFOLDER Dec 23, 2022 at 14:56
  • It's the same. Just says Publish started and shows no progress. I had to stop iis after 30 mins.
    – sukesh
    Dec 27, 2022 at 4:50
  • While it does not show the items being published, it works for me. Items were delivered to web. Also tried with '--verbosity' flag but not a big diff in output. Jul 10, 2023 at 9:54
1

Check your sitecore.cli version using dotnet tool list for me its 5.1.25

If you run dotnet sitecore publish --help. It will show you a default path like (Path to root sitecore.json directory (default: cwd) [default: 'Your directory path'])

It should be a path where .sitecore.json resides. Try with full path like in my case it is dotnet sitecore publish --config 'C:\somefolder\test'

enter image description here

Hope it helps!

6
  • I have 5.1.25. Provided the whole path and it's still the same. I have updated my question. Could you please have a look.
    – sukesh
    Jan 5, 2023 at 4:37
  • 1
    You could also try and see if it works. 1. Change the path in sitecore.json file as "src/SCS/Modules/*.Module.json" as with the default path with vanilla setup is like ("src/*.module.json"). 2. Just set up and rename at least 1 file according to the vanilla setup path structure ("src/*.module.json") and see if it works for that one only. Jan 5, 2023 at 5:03
  • I have renamed one file to Core.Module.json & moved it src folder. Updated the path in sitecore.json. It's still the same.
    – sukesh
    Jan 5, 2023 at 6:49
  • One more thing we could try is just set up the vanilla jss project in a different folder and try with the default modules file. If it works fine then something is wrong in the configuration file and you can compare the order of the plugins node in the sitecore.json file Jan 5, 2023 at 7:14
  • What I have is a vanilla instance. Can you please share the order of plugins that's working for you. The order I have is in the question.
    – sukesh
    Jan 5, 2023 at 7:57
1

There could be two reasons the command is failing.

  1. Some of the Sitecore CLI commands wrap items names in single quotes for correct interpretation by PowerShell
  2. The command may have been executed outside a Sitecore project.

Try with this - dotnet sitecore publish --config '.\sitecore.json'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.