1 | <Project Sdk="Microsoft.NET.Sdk.Web">
|
---|
2 |
|
---|
3 | <PropertyGroup>
|
---|
4 | <TargetFramework>netcoreapp3.1</TargetFramework>
|
---|
5 | <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
---|
6 | <TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
|
---|
7 | <IsPackable>false</IsPackable>
|
---|
8 | <SpaRoot>ClientApp\</SpaRoot>
|
---|
9 | <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
|
---|
10 |
|
---|
11 | <!-- Set this to true if you enable server-side prerendering -->
|
---|
12 | <BuildServerSideRenderer>false</BuildServerSideRenderer>
|
---|
13 | </PropertyGroup>
|
---|
14 |
|
---|
15 | <ItemGroup>
|
---|
16 | <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.6" />
|
---|
17 | <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.6" />
|
---|
18 | <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.6">
|
---|
19 | <PrivateAssets>all</PrivateAssets>
|
---|
20 | <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
---|
21 | </PackageReference>
|
---|
22 | <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.6">
|
---|
23 | <PrivateAssets>all</PrivateAssets>
|
---|
24 | <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
---|
25 | </PackageReference>
|
---|
26 | <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.4" />
|
---|
27 | </ItemGroup>
|
---|
28 |
|
---|
29 | <ItemGroup>
|
---|
30 | <!-- Don't publish the SPA source files, but do show them in the project files list -->
|
---|
31 | <Content Remove="$(SpaRoot)**" />
|
---|
32 | <None Remove="$(SpaRoot)**" />
|
---|
33 | <None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
|
---|
34 | </ItemGroup>
|
---|
35 |
|
---|
36 | <ItemGroup>
|
---|
37 | <ProjectReference Include="..\FarmatikoData\FarmatikoData.csproj" />
|
---|
38 | </ItemGroup>
|
---|
39 |
|
---|
40 | <Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
|
---|
41 | <!-- Ensure Node.js is installed -->
|
---|
42 | <Exec Command="node --version" ContinueOnError="true">
|
---|
43 | <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
|
---|
44 | </Exec>
|
---|
45 | <Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
|
---|
46 | <Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
|
---|
47 | <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
|
---|
48 | </Target>
|
---|
49 |
|
---|
50 | <Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
|
---|
51 | <!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
|
---|
52 | <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
|
---|
53 | <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod" />
|
---|
54 | <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
|
---|
55 |
|
---|
56 | <!-- Include the newly-built files in the publish output -->
|
---|
57 | <ItemGroup>
|
---|
58 | <DistFiles Include="$(SpaRoot)dist\**; $(SpaRoot)dist-server\**" />
|
---|
59 | <DistFiles Include="$(SpaRoot)node_modules\**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
|
---|
60 | <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
|
---|
61 | <RelativePath>%(DistFiles.Identity)</RelativePath>
|
---|
62 | <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
---|
63 | <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
---|
64 | </ResolvedFileToPublish>
|
---|
65 | </ItemGroup>
|
---|
66 | </Target>
|
---|
67 |
|
---|
68 | </Project>
|
---|