-
Notifications
You must be signed in to change notification settings - Fork 511
Expand file tree
/
Copy pathBlogifier.Themes.Standard.csproj
More file actions
85 lines (74 loc) · 5.5 KB
/
Blogifier.Themes.Standard.csproj
File metadata and controls
85 lines (74 loc) · 5.5 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<ClientAssetsDirectory>assets\</ClientAssetsDirectory>
<ClientAssetsRestoreCommand>npm i</ClientAssetsRestoreCommand>
<ClientAssetsBuildCommand>npm run build:$(Configuration)</ClientAssetsBuildCommand>
<!-- CompressionEnabled set to false, this is a workarround to resolve
issue: https://github.com/dotnet/aspnetcore/issues/59291 -->
<CompressionEnabled>false</CompressionEnabled>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Blogifier.Shared\Blogifier.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<Content Remove="$(ClientAssetsDirectory)\**" />
<None Remove="$(ClientAssetsDirectory)\**" />
<None Include="$(ClientAssetsDirectory)**" Exclude="$(ClientAssetsDirectory)node_modules\**" />
</ItemGroup>
<!-- https://devblogs.microsoft.com/dotnet/build-client-web-assets-for-your-razor-class-library -->
<!-- https://github.com/aspnet/AspLabs/blob/main/src/ClientAssets/Microsoft.AspNetCore.ClientAssets/build/netstandard2.0/Microsoft.AspNetCore.ClientAssets.targets -->
<PropertyGroup>
<ClientAssetsRestoreInputs>$(ClientAssetsDirectory)package-lock.json;$(ClientAssetsDirectory)package.json</ClientAssetsRestoreInputs>
<ClientAssetsRestoreOutputs>$(ClientAssetsDirectory)node_modules\.package-lock.json</ClientAssetsRestoreOutputs>
<ClientAssetsRestoreInputs>$(MSBuildProjectFile);$(ClientAssetsRestoreInputs)</ClientAssetsRestoreInputs>
<!-- Run restore only once for multi targeting builds -->
<ClientAssetsRestoreBeforeTargets Condition="'$(TargetFramework)' == ''">DispatchToInnerBuilds</ClientAssetsRestoreBeforeTargets>
<!-- Allow multitargeting projects to choose the target framework in which they run by setting this value to true only for a given target framework -->
<ShouldRunClientAssetsBuild Condition="'$(ShouldRunClientAssetsBuild)' == ''">true</ShouldRunClientAssetsBuild>
<ClientAssetsBuildOutput>$(ClientAssetsDirectory)\dist\</ClientAssetsBuildOutput>
</PropertyGroup>
<ItemGroup>
<ClientAssetsInputs Include="$(ClientAssetsDirectory)**" Exclude="$(DefaultItemExcludes)" />
<ProjectCapability Include="ClientAssetsAlpha" />
</ItemGroup>
<!--<Target Name="ClientAssetsClean" BeforeTargets="Clean">
<RemoveDir Directories="$(ClientAssetsBuildOutput)" />
<Delete Files="$(IntermediateOutputPath)clientassetsbuild.complete.txt" />
</Target>-->
<Target Name="ClientAssetsRestore" BeforeTargets="$(ClientAssetsRestoreBeforeTargets)" Inputs="$(ClientAssetsRestoreInputs)" Outputs="$(ClientAssetsRestoreOutputs)">
<Message Importance="high" Text="Running $(ClientAssetsRestoreCommand)..." />
<Exec Command="$(ClientAssetsRestoreCommand)" WorkingDirectory="$(ClientAssetsDirectory)" />
</Target>
<Target Name="ClientAssetsBuild" Condition="'$(ShouldRunClientAssetsBuild)' == 'true'" DependsOnTargets="ClientAssetsRestore" BeforeTargets="AssignTargetPaths" Inputs="@(ClientAssetsInputs)" Outputs="$(IntermediateOutputPath)clientassetsbuild.complete.txt">
<Exec WorkingDirectory="$(ClientAssetsDirectory)" Command="$(ClientAssetsBuildCommand)" />
<PropertyGroup>
<_ClientAssetsOutputFullPath>$([System.IO.Path]::GetFullPath('$(ClientAssetsBuildOutput)'))/</_ClientAssetsOutputFullPath>
</PropertyGroup>
<ItemGroup>
<_ClientAssetsBuildOutput Include="$(ClientAssetsBuildOutput)**"></_ClientAssetsBuildOutput>
</ItemGroup>
<WriteLinesToFile File="$(IntermediateOutputPath)clientassetsbuild.complete.txt" Lines="@(_ClientAssetsBuildOutput)" />
</Target>
<Target Name="DefineClientAssets" AfterTargets="ClientAssetsBuild" DependsOnTargets="ResolveStaticWebAssetsConfiguration">
<ItemGroup>
<FileWrites Include="@(_ClientAssetsBuildOutput)" />
<FileWrites Include="$(IntermediateOutputPath)clientassetsbuild.complete.txt" />
<Content Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND $([MSBuild]::VersionLessThan('$(TargetFrameworkVersion)', '6.0')) " Include="@(_ClientAssetsBuildOutput)" Link="wwwroot\%(_ClientAssetsBuildOutput.RecursiveDir)\%(_ClientAssetsBuildOutput.FileName)%(_ClientAssetsBuildOutput.Extension)" />
</ItemGroup>
<!-- Note: We separate this target into two because content assets from outside the wwwroot folder won't get the right content root due to a bug/limitation
within DiscoverStaticWebAssets. That doesn't matter for when the assets are being packaged, as the content root doesn't matter in that case, but will impact
the ability to consume them from project references. As a workaround, we are using the Task directly on this package, to make sure this scenario works. In a future
release we will address this by aligning DiscoverStaticWebAssets behavior with DefineStaticWebAssets to follow the same heuristics for determining the content root.
-->
<DefineStaticWebAssets Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '6.0'))" CandidateAssets="@(_ClientAssetsBuildOutput)" SourceId="$(PackageId)" SourceType="Computed" ContentRoot="$(_ClientAssetsOutputFullPath)" BasePath="$(StaticWebAssetBasePath)">
<Output TaskParameter="Assets" ItemName="StaticWebAsset" />
</DefineStaticWebAssets>
</Target>
</Project>