Skip to content

Commit c585f77

Browse files
author
Paul Johnson
authored
Merge pull request #11211 from umbraco/v9/bugfix/fix-build-required-before-initial-publish
v9 Fix build required before initial publish
2 parents 56595a7 + 7a92976 commit c585f77

File tree

2 files changed

+45
-13
lines changed

2 files changed

+45
-13
lines changed

build/NuSpecs/buildTransitive/Umbraco.Cms.StaticAssets.targets

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
<UmbracoWwwrootName Condition="'$(UmbracoWwwrootName)' == ''">umbraco</UmbracoWwwrootName>
77
</PropertyGroup>
88

9+
<PropertyGroup>
10+
<DefaultItemExcludes>$(DefaultItemExcludes);App_Plugins\**;</DefaultItemExcludes>
11+
12+
<DefaultItemExcludes>$(DefaultItemExcludes);umbraco\Data\**;</DefaultItemExcludes>
13+
<DefaultItemExcludes>$(DefaultItemExcludes);umbraco\Logs\**;</DefaultItemExcludes>
14+
<DefaultItemExcludes>$(DefaultItemExcludes);umbraco\mediacache\**;</DefaultItemExcludes>
15+
16+
<DefaultItemExcludes>$(DefaultItemExcludes);wwwroot\media\**;</DefaultItemExcludes>
17+
</PropertyGroup>
18+
919
<Target Name="CopyUmbracoAssets" BeforeTargets="BeforeBuild">
1020
<ItemGroup>
1121
<ContentFiles Include="$(ContentFilesPath)" />
@@ -21,7 +31,42 @@
2131
SourceFiles="@(ContentWwwrootFiles)"
2232
DestinationFiles="@(ContentWwwrootFiles->'$(MSBuildProjectDirectory)\wwwroot\$(UmbracoWwwrootName)\%(RecursiveDir)%(Filename)%(Extension)')"
2333
SkipUnchangedFiles="true" />
34+
</Target>
35+
36+
<Target Name="IncludeAppPluginsContent" BeforeTargets="GetCopyToOutputDirectoryItems">
37+
<ItemGroup>
38+
<_AppPluginsFiles Include="App_Plugins\**" />
2439

40+
<ContentWithTargetPath
41+
Include="@(_AppPluginsFiles)"
42+
TargetPath="%(Identity)"
43+
CopyToOutputDirectory="Always" />
44+
</ItemGroup>
45+
</Target>
46+
47+
<!--
48+
The set of files to publish is generated really early and doesn't currently account for files added by targets e.g. BeforeBuild.
49+
A fix was put in place in Web SDK to update for wwwwroot in case someone runs npm build etc in a target, we're borrowing their trick.
50+
https://github.com/dotnet/sdk/blob/e2b2b1a4ac56c955b84d62fe71cda3b6f258b42b/src/WebSdk/Publish/Targets/ComputeTargets/Microsoft.NET.Sdk.Publish.ComputeFiles.targets
51+
-->
52+
<Target Name="IncludeUmbracoFolderContent" BeforeTargets="GetCopyToOutputDirectoryItems">
53+
<ItemGroup>
54+
<_UmbracoFolderFiles Include="umbraco\config\**" />
55+
<_UmbracoFolderFiles Include="umbraco\PartialViewMacros\**" />
56+
<_UmbracoFolderFiles Include="umbraco\UmbracoBackOffice\**" />
57+
<_UmbracoFolderFiles Include="umbraco\UmbracoInstall\**" />
58+
<_UmbracoFolderFiles Include="umbraco\UmbracoWebsite\**" />
59+
<_UmbracoFolderFiles Include="umbraco\UmbracoWebsite\**" />
60+
<_UmbracoFolderFiles Include="umbraco\Licenses\**" />
61+
62+
<!-- This could be handled in deploy if it's not already -->
63+
<_UmbracoFolderFiles Include="umbraco\Deploy\**" />
64+
65+
<ContentWithTargetPath
66+
Include="@(_UmbracoFolderFiles)"
67+
TargetPath="%(Identity)"
68+
CopyToOutputDirectory="Always" />
69+
</ItemGroup>
2570
</Target>
2671

2772
<Target Name="ClearUmbracoAssets" BeforeTargets="Clean">

build/templates/UmbracoProject/UmbracoProject.csproj

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
<PropertyGroup>
44
<TargetFramework>net5.0</TargetFramework>
55
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">Umbraco.Cms.Web.UI</RootNamespace>
6-
<DefaultItemExcludes>$(DefaultItemExcludes);App_Plugins/**;</DefaultItemExcludes>
7-
<DefaultItemExcludes>$(DefaultItemExcludes);umbraco/**;</DefaultItemExcludes>
8-
<DefaultItemExcludes>$(DefaultItemExcludes);wwwroot/media/**;</DefaultItemExcludes>
96
</PropertyGroup>
107

118
<!-- Force windows to use ICU. Otherwise Windows 10 2019H1+ will do it, but older windows 10 and most if not all winodws servers will run NLS -->
@@ -26,16 +23,6 @@
2623
<ProjectReference Include="..\PackageTestSiteName\PackageTestSiteName.csproj" />
2724
</ItemGroup>
2825

29-
<ItemGroup>
30-
<Content Include="App_Plugins/**" CopyToOutputDirectory="Always" />
31-
<Content Include="umbraco/**" CopyToOutputDirectory="Always" />
32-
<Content Remove="umbraco/Data/**" />
33-
<Content Remove="umbraco/Logs/**" />
34-
<Content Remove="umbraco/mediacache/**" />
35-
<Content Remove="umbraco/models/**" />
36-
<Compile Include="umbraco/models/**" Exclude="**/*.flag" />
37-
</ItemGroup>
38-
3926
<PropertyGroup>
4027
<CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>
4128
</PropertyGroup>

0 commit comments

Comments
 (0)