Handle the msbuild copy in two steps, so we can override the wwwroot/umbraco folder from outside, using the following in the project csproj.

<PropertyGroup>
        <UmbracoWwwrootName>my-secret-loginpanel</UmbracoWwwrootName>
    </PropertyGroup>

    it will now copy to wwwroot/my-secret-loginpanel instead of wwwroot/umbraco
This commit is contained in:
Bjarke Berg
2021-09-01 10:57:21 +02:00
parent 5953c9ebe7
commit 2876d0b179
2 changed files with 12 additions and 4 deletions

View File

@@ -1,18 +1,26 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ContentFilesPath>$(MSBuildThisFileDirectory)..\content\**\*.*</ContentFilesPath>
<ContentFilesPath>$(MSBuildThisFileDirectory)..\content\umbraco\**\*.*</ContentFilesPath>
<ContentWwwrootFilesPath>$(MSBuildThisFileDirectory)..\content\wwwroot\umbraco\**\*.*</ContentWwwrootFilesPath>
<UmbracoWwwrootName Condition="'$(UmbracoWwwrootName)' == ''">umbraco</UmbracoWwwrootName>
</PropertyGroup>
<Target Name="CopyUmbracoAssets" BeforeTargets="Build">
<ItemGroup>
<ContentFiles Include="$(ContentFilesPath)" />
<ContentWwwrootFiles Include="$(ContentWwwrootFilesPath)" />
</ItemGroup>
<Message Text="Copying Umbraco content files: $(ContentFilesPath) - #@(ContentFiles->Count()) files" Importance="high" />
<Message Text="Copying Umbraco wwwroot content files: $(ContentWwwrootFilesPath) - #@(ContentWwwrootFiles->Count()) files" Importance="high" />
<Copy
SourceFiles="@(ContentFiles)"
DestinationFiles="@(ContentFiles->'$(MSBuildProjectDirectory)\%(RecursiveDir)%(Filename)%(Extension)')"
DestinationFiles="@(ContentFiles->'$(MSBuildProjectDirectory)\umbraco\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />
<Copy
SourceFiles="@(ContentWwwrootFiles)"
DestinationFiles="@(ContentWwwrootFiles->'$(MSBuildProjectDirectory)\wwwroot\$(UmbracoWwwrootName)\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />
</Target>
@@ -24,7 +32,7 @@
<UmbracoUmbracoBackOfficeMacrosDir Include="$(MSBuildProjectDirectory)\umbraco\UmbracoBackOffice\" />
<UmbracoUmbracoInstallDir Include="$(MSBuildProjectDirectory)\umbraco\UmbracoInstall\" />
<UmbracoUmbracoWebsiteMacrosDir Include="$(MSBuildProjectDirectory)\umbraco\UmbracoWebsite\" />
<WwwrootUmbracoPackageDir Include="$(MSBuildProjectDirectory)\wwwroot\umbraco\" />
<WwwrootUmbracoPackageDir Include="$(MSBuildProjectDirectory)\wwwroot\$(UmbracoWwwrootName)\" />
</ItemGroup>
<Message Text="Clear old umbraco data" Importance="high" />
<RemoveDir Directories="@(UmbracoConfigPackageDir)" />