Skip to main content
Version: v13.x - Umbraco 13

uSync.Once / Stop Files

uSync.once and uSync.stop are special files that you can use on your deployments to control how uSync imports will run at startup.

If you site has the ImportAtStartup setting configured to import items when the site starts up then the uSync.once and uSync.stop files will be checked.

uSync.Once​

If your uSync folder (uSync/v9) contains a uSync.once file, uSync will perform an import at startup and then change the uSync.once file into a uSync.stop file.

uSync.Stop​

If the uSync folder contains a uSync.stop file then uSync will not perform an import even if the ImportAtStartup setting is true.

One Time Import​

The main purpose of the uSync.once and uSync.stop files are to allow you to perform a one time import when you deploy your site, but then an import will not run should your site restart without deployment.

  1. Write a uSync.once file to the site on deployment.
  2. When the site starts up uSync will perform and import and rename uSync.once to uSync.stop.
  3. If the site restarts or reloads without a deployment the uSync.stop file will prevent any imports from happening.

Adding the Once File at Publish.​

Adding the following to the .csproj file will create the Once file when you do a dotnet publish:

<!-- copy a "_usync.once" file to "usync/usync.once" on publish -->
<ItemGroup>
<ResolvedFileToPublish Include="uSync/_usync.once">
<RelativePath>uSync/v9/usync.once</RelativePath>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
</ResolvedFileToPublish>
</ItemGroup>