|
| 1 | +<Project Sdk="Microsoft.NET.Sdk.Web"> |
| 2 | + |
| 3 | + <PropertyGroup> |
| 4 | + <TargetFramework>net8.0</TargetFramework> |
| 5 | + <LangVersion>9.0</LangVersion> |
| 6 | + <RootNamespace>BlazorDemos</RootNamespace> |
| 7 | + <EnableMSDeployAppOffline>true</EnableMSDeployAppOffline> |
| 8 | + <ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles> |
| 9 | + <Nullable>enable</Nullable> |
| 10 | + </PropertyGroup> |
| 11 | + |
| 12 | + <Target Name="RemoveStaticFiles" AfterTargets="AfterPublish"> |
| 13 | + <PropertyGroup> |
| 14 | + <Files>$(PublishDir)\wwwroot\_content</Files> |
| 15 | + </PropertyGroup> |
| 16 | + |
| 17 | + <ItemGroup> |
| 18 | + <Directories Include="$(Files)\**" Exclude=" $(Files)\Syncfusion.Blazor.*\**;$(Files)\Blazor_Server_Common_NET8\**;" /> |
| 19 | + </ItemGroup> |
| 20 | + |
| 21 | + <Delete Files="@(Directories)" ContinueOnError="true" /> |
| 22 | + </Target> |
| 23 | + |
| 24 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> |
| 25 | + <DefineConstants>TRACE;RELEASE;NET8_0;$(SyncfusionLicensing);STAGING</DefineConstants> |
| 26 | + <ConfigurationValue>Release</ConfigurationValue> |
| 27 | + <Staging Condition="'$(DefineConstants)' != '' and $(DefineConstants.Contains('STAGING'))">true</Staging> |
| 28 | + </PropertyGroup> |
| 29 | + |
| 30 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> |
| 31 | + <DefineConstants>TRACE;DEBUG;NET8_0;STAGING</DefineConstants> |
| 32 | + <ConfigurationValue>Debug</ConfigurationValue> |
| 33 | + </PropertyGroup> |
| 34 | + |
| 35 | + <PropertyGroup Condition="'$(STAGING)' != ''"> |
| 36 | + <DefineConstants>$(DefineConstants);STAGING</DefineConstants> |
| 37 | + </PropertyGroup> |
| 38 | + |
| 39 | + <PropertyGroup Condition="'$(ISSTAGING)' != ''"> |
| 40 | + <DefineConstants>$(DefineConstants);ISSTAGING</DefineConstants> |
| 41 | + </PropertyGroup> |
| 42 | + |
| 43 | + <!-- Set AppEnvironment to Debug if Configuration is Debug OR STAGING is true --> |
| 44 | + <PropertyGroup Condition="'$(Configuration)' == 'Debug' Or '$(Staging)' == 'true'"> |
| 45 | + <AppEnvironment>Debug</AppEnvironment> |
| 46 | + </PropertyGroup> |
| 47 | + |
| 48 | + <!-- Default to Release if AppEnvironment is not already set --> |
| 49 | + <PropertyGroup Condition="'$(AppEnvironment)' == ''"> |
| 50 | + <AppEnvironment>Release</AppEnvironment> |
| 51 | + </PropertyGroup> |
| 52 | + |
| 53 | + <!-- Set AppEnvironment to Staging if Configuration is Release AND Staging is true --> |
| 54 | + <PropertyGroup Condition="'$(Configuration)' == 'Release' And '$(Staging)' == 'true'"> |
| 55 | + <AppEnvironment>Staging</AppEnvironment> |
| 56 | + </PropertyGroup> |
| 57 | + |
| 58 | + <Target Name="UpdateScriptReference" BeforeTargets="BeforeBuild" Condition="'$(Configuration)'=='Release'"> |
| 59 | + <ReadLinesFromFile File="Components\App.razor"> |
| 60 | + <Output TaskParameter="Lines" ItemName="AppRazorLines" /> |
| 61 | + </ReadLinesFromFile> |
| 62 | + <ItemGroup> |
| 63 | + <AppRazorLinesUpdated Include="@(AppRazorLines->Replace('index.js','index.min.js'))" /> |
| 64 | + </ItemGroup> |
| 65 | + <WriteLinesToFile File="Components\App.razor" Lines="@(AppRazorLinesUpdated)" Overwrite="true" /> |
| 66 | + </Target> |
| 67 | + |
| 68 | + <Target Name="MinifyAssets" BeforeTargets="BeforeBuild" Condition="'$(Configuration)'=='Release'"> |
| 69 | + |
| 70 | + <ItemGroup> |
| 71 | + <_CssFiles Include="..\Common\wwwroot\**\*.css" Exclude="..\Common\wwwroot\**\*.min.css" /> |
| 72 | + <_JsFiles Include="..\Common\wwwroot\**\*.js" Exclude="..\Common\wwwroot\**\*.min.js" /> |
| 73 | + </ItemGroup> |
| 74 | + |
| 75 | + <Exec |
| 76 | + Command="dotnet "../Common/AssetMinifier/Blazor-StaticAssetMinifier/AssetMinifier.dll" "%( _CssFiles.FullPath )"" |
| 77 | + Condition="Exists('%( _CssFiles.FullPath )')" |
| 78 | + StandardOutputImportance="High" |
| 79 | + StandardErrorImportance="High" /> |
| 80 | + |
| 81 | + <Exec |
| 82 | + Command="dotnet "../Common/AssetMinifier/Blazor-StaticAssetMinifier/AssetMinifier.dll" "%( _JsFiles.FullPath )"" |
| 83 | + Condition="Exists('%( _JsFiles.FullPath )')" |
| 84 | + StandardOutputImportance="High" |
| 85 | + StandardErrorImportance="High" /> |
| 86 | + |
| 87 | + </Target> |
| 88 | + |
| 89 | + <Target Name="ProductionBuild" BeforeTargets="BeforeBuild"> |
| 90 | + <Delete Files="wwwroot/version.js" /> |
| 91 | + <WriteLinesToFile File="wwwroot/version.js" Lines='export const data={"version":"net8.0","configuration":"$(AppEnvironment)"}' /> |
| 92 | + </Target> |
| 93 | + |
| 94 | + <ItemGroup> |
| 95 | + <Compile Remove="Components\Layout\**" /> |
| 96 | + <Content Remove="Components\Layout\**" /> |
| 97 | + <EmbeddedResource Remove="Components\Layout\**" /> |
| 98 | + <None Remove="Components\Layout\**" /> |
| 99 | + </ItemGroup> |
| 100 | + |
| 101 | + <ItemGroup> |
| 102 | + <Content Remove="App.razor" /> |
| 103 | + <Content Remove="wwwroot\Blazor_Server_Demos_NET10.lib.module.js" /> |
| 104 | + <Content Remove="wwwroot\Blazor_Server_Demos_NET9.lib.module.js" /> |
| 105 | + </ItemGroup> |
| 106 | + |
| 107 | + <ItemGroup> |
| 108 | + <ProjectReference Include="..\Common\Blazor_Server_Common_NET8.csproj" /> |
| 109 | + </ItemGroup> |
| 110 | + |
| 111 | +</Project> |
0 commit comments