Ensure Umbraco Razor files are compiled into <project>.Views.dll

It worked properly if the Umbraco files are on disk before a build
but when the files are not there yet or a dotnet clean is done first the
files are not compiled. This is often the case on build servers that start
with a clean working directory for each build.

Using this target we simply ensure the files are included as "Content"
which Razor will scan for .cshtml files in their "ResolveRazorGenerateInputs"
target.
This commit is contained in:
Daniël Knippers
2021-12-14 12:25:25 +01:00
parent 5d2c950073
commit 95efeeabcf

View File

@@ -87,4 +87,10 @@
<RemoveDir Directories="@(WwwrootUmbracoPackageDir)" />
</Target>
<Target Name="IncludeUmbracoRazorFiles" BeforeTargets="ResolveRazorGenerateInputs">
<ItemGroup>
<Content Include="$(MSBuildProjectDirectory)\umbraco\**\*.cshtml" />
</ItemGroup>
</Target>
</Project>