Skip to content

Commit

Permalink
Merge pull request umbraco#11211 from umbraco/v9/bugfix/fix-build-req…
Browse files Browse the repository at this point in the history
…uired-before-initial-publish

v9 Fix build required before initial publish
  • Loading branch information
Paul Johnson authored Oct 21, 2021
2 parents 56595a7 + 7a92976 commit c585f77
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 13 deletions.
45 changes: 45 additions & 0 deletions build/NuSpecs/buildTransitive/Umbraco.Cms.StaticAssets.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
<UmbracoWwwrootName Condition="'$(UmbracoWwwrootName)' == ''">umbraco</UmbracoWwwrootName>
</PropertyGroup>

<PropertyGroup>
<DefaultItemExcludes>$(DefaultItemExcludes);App_Plugins\**;</DefaultItemExcludes>

<DefaultItemExcludes>$(DefaultItemExcludes);umbraco\Data\**;</DefaultItemExcludes>
<DefaultItemExcludes>$(DefaultItemExcludes);umbraco\Logs\**;</DefaultItemExcludes>
<DefaultItemExcludes>$(DefaultItemExcludes);umbraco\mediacache\**;</DefaultItemExcludes>

<DefaultItemExcludes>$(DefaultItemExcludes);wwwroot\media\**;</DefaultItemExcludes>
</PropertyGroup>

<Target Name="CopyUmbracoAssets" BeforeTargets="BeforeBuild">
<ItemGroup>
<ContentFiles Include="$(ContentFilesPath)" />
Expand All @@ -21,7 +31,42 @@
SourceFiles="@(ContentWwwrootFiles)"
DestinationFiles="@(ContentWwwrootFiles->'$(MSBuildProjectDirectory)\wwwroot\$(UmbracoWwwrootName)\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />
</Target>

<Target Name="IncludeAppPluginsContent" BeforeTargets="GetCopyToOutputDirectoryItems">
<ItemGroup>
<_AppPluginsFiles Include="App_Plugins\**" />

<ContentWithTargetPath
Include="@(_AppPluginsFiles)"
TargetPath="%(Identity)"
CopyToOutputDirectory="Always" />
</ItemGroup>
</Target>

<!--
The set of files to publish is generated really early and doesn't currently account for files added by targets e.g. BeforeBuild.
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.
https://github.com/dotnet/sdk/blob/e2b2b1a4ac56c955b84d62fe71cda3b6f258b42b/src/WebSdk/Publish/Targets/ComputeTargets/Microsoft.NET.Sdk.Publish.ComputeFiles.targets
-->
<Target Name="IncludeUmbracoFolderContent" BeforeTargets="GetCopyToOutputDirectoryItems">
<ItemGroup>
<_UmbracoFolderFiles Include="umbraco\config\**" />
<_UmbracoFolderFiles Include="umbraco\PartialViewMacros\**" />
<_UmbracoFolderFiles Include="umbraco\UmbracoBackOffice\**" />
<_UmbracoFolderFiles Include="umbraco\UmbracoInstall\**" />
<_UmbracoFolderFiles Include="umbraco\UmbracoWebsite\**" />
<_UmbracoFolderFiles Include="umbraco\UmbracoWebsite\**" />
<_UmbracoFolderFiles Include="umbraco\Licenses\**" />

<!-- This could be handled in deploy if it's not already -->
<_UmbracoFolderFiles Include="umbraco\Deploy\**" />

<ContentWithTargetPath
Include="@(_UmbracoFolderFiles)"
TargetPath="%(Identity)"
CopyToOutputDirectory="Always" />
</ItemGroup>
</Target>

<Target Name="ClearUmbracoAssets" BeforeTargets="Clean">
Expand Down
13 changes: 0 additions & 13 deletions build/templates/UmbracoProject/UmbracoProject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">Umbraco.Cms.Web.UI</RootNamespace>
<DefaultItemExcludes>$(DefaultItemExcludes);App_Plugins/**;</DefaultItemExcludes>
<DefaultItemExcludes>$(DefaultItemExcludes);umbraco/**;</DefaultItemExcludes>
<DefaultItemExcludes>$(DefaultItemExcludes);wwwroot/media/**;</DefaultItemExcludes>
</PropertyGroup>

<!-- 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 -->
Expand All @@ -26,16 +23,6 @@
<ProjectReference Include="..\PackageTestSiteName\PackageTestSiteName.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="App_Plugins/**" CopyToOutputDirectory="Always" />
<Content Include="umbraco/**" CopyToOutputDirectory="Always" />
<Content Remove="umbraco/Data/**" />
<Content Remove="umbraco/Logs/**" />
<Content Remove="umbraco/mediacache/**" />
<Content Remove="umbraco/models/**" />
<Compile Include="umbraco/models/**" Exclude="**/*.flag" />
</ItemGroup>

<PropertyGroup>
<CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>
</PropertyGroup>
Expand Down

0 comments on commit c585f77

Please sign in to comment.