This repository has been archived by the owner on Dec 4, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 88
/
Directory.Build.targets
46 lines (41 loc) · 2.18 KB
/
Directory.Build.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<Project>
<Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.0.79" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets')" />
<!-- Auto publish on build-->
<Target Name="AutoPublish" AfterTargets="Build">
<PropertyGroup>
<publishUrl Condition="!HasTrailingSlash('$(publishUrl)')">$(publishUrl)/</publishUrl>
<PublishDir Condition="!HasTrailingSlash('$(PublishDir)')">$(PublishDir)/</PublishDir>
</PropertyGroup>
<CallTarget Targets="WebPublish" Condition="'$(WebPublishOnBuild)'=='True'" />
<CallTarget Targets="Publish" Condition="'$(PublishOnBuild)'=='True'" />
</Target>
<ItemGroup>
<!-- TODO: Remove this itemgroup and reference Sitecore.Assemblies.SitecoreHeadlessServicesServer nuget when layoutservice is upgraded -->
<SitecoreAssemblies Include="Sitecore.LayoutService.dll" />
<SitecoreAssemblies Include="Sitecore.LayoutService.Mvc.dll" />
</ItemGroup>
<Target Name="RemoveAssembliesFromPublish" AfterTargets="ResolveReferences">
<ItemGroup>
<_IgnoredFiles Include="@(SitecoreAssemblies)" Condition="'@(SitecoreAssemblies)' != ''" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(Filename)' != '' and '@(_IgnoredFiles)' != ''" />
</ItemGroup>
</Target>
<!--
Workaround for 'dotnet watch' issue with referenced MVC projects.
https://github.com/dotnet/aspnetcore/issues/22219
-->
<Target Name="RazorWatch" BeforeTargets="_CoreCollectWatchItems" Condition="'$(DotNetWatchBuild)' == 'true'">
<ItemGroup>
<RazorWatch Include="**\*.cshtml" />
<Watch Include="%(RazorWatch.FullPath)" />
</ItemGroup>
</Target>
<Target Name="FixDotnetWatch" AfterTargets="_CoreCollectWatchItems">
<ItemGroup>
<_WatchRelativePath Include="@(Watch)" Condition="'%(Identity)' != '%(Watch.FullPath)'" />
<Watch Remove="@(_WatchRelativePath)" />
<Watch Include="%(_WatchRelativePath.FullPath)" />
</ItemGroup>
</Target>
</Project>