U4-10183 - umbraco and umbraco_client folders are not updated when restoring nuget package

Created by simone chiaretta 20 Jul 2017, 11:58:26 Updated by Jesse Andrews 12 Jun 2018, 22:05:25

When updating Umbraco using the nuget package directly, the UmbracoFiles are updated correctly. However when the new nuget package version is stored in the packages.config and restored on another machine, the various umbraco folders are not overwritten.

I've found the issue is in the build\UmbracoCms.targets file. It is copying the files from the package only if they don't already exist (see Condition="!Exists(...)" in the target file below.

  <Target Name="CopyUmbracoFilesToWebRoot" BeforeTargets="AfterBuild">
      <UmbracoFiles Include="$(UmbracoFilesFolder)**\*" />
    <Copy SourceFiles="%(UmbracoFiles.FullPath)" DestinationFiles="%(RecursiveDir)%(Filename)%(Extension)"
Condition="!Exists('%(RecursiveDir)%(Filename)%(Extension)')" />

This works on a fresh installation but not if you had installed Umbraco already and are just performing an upgrade using restore package as the old files will be there already.

I see a few possible solutions:

  • just remove the condition and always copy over new files (might slow down build and deploy if always done, and also will overwrite changes done to core files by bad developers :))
  • Apply the patch proposed in U4-7015 which to check not just existence but also if modified date is different (still might overwrite changes done to core)
  • remove condition and use the SkipUnchangedFiles of the [MsBuild copy task|https://msdn.microsoft.com/en-us/library/3e54c37h.aspx] which will check size and timestamp (this should make sure customized files are not changed)

I can do some tests and send a PR if needed.

Workaround is: just manually delete all affected folders before building after the update


Jesse Andrews 12 Jun 2018, 22:05:25

I've run into this issue as well upgrading to 7.10.4.

Priority: Normal

Type: Bug

State: Submitted


Difficulty: Normal

Category: Installation

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.6.1, 7.6.2, 7.6.3, 7.6.4

Due in version:


Story Points: