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 | <Compile Remove="Controllers\WeatherForecastController.cs" />
|
---|
38 | <Compile Remove="WeatherForecast.cs" />
|
---|
39 | </ItemGroup>
|
---|
40 |
|
---|
41 | <ItemGroup>
|
---|
42 | <ProjectReference Include="..\FarmatikoData\FarmatikoData.csproj" />
|
---|
43 | <ProjectReference Include="..\FarmatikoServices\FarmatikoServices.csproj" />
|
---|
44 | </ItemGroup>
|
---|
45 |
|
---|
46 | <Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
|
---|
47 | <!-- Ensure Node.js is installed -->
|
---|
48 | <Exec Command="node --version" ContinueOnError="true">
|
---|
49 | <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
|
---|
50 | </Exec>
|
---|
51 | <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." />
|
---|
52 | <Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
|
---|
53 | <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
|
---|
54 | </Target>
|
---|
55 |
|
---|
56 | <Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
|
---|
57 | <!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
|
---|
58 | <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
|
---|
59 | <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod" />
|
---|
60 | <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
|
---|
61 |
|
---|
62 | <!-- Include the newly-built files in the publish output -->
|
---|
63 | <ItemGroup>
|
---|
64 | <DistFiles Include="$(SpaRoot)dist\**; $(SpaRoot)dist-server\**" />
|
---|
65 | <DistFiles Include="$(SpaRoot)node_modules\**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
|
---|
66 | <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
|
---|
67 | <RelativePath>%(DistFiles.Identity)</RelativePath>
|
---|
68 | <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
---|
69 | <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
---|
70 | </ResolvedFileToPublish>
|
---|
71 | </ItemGroup>
|
---|
72 | </Target>
|
---|
73 |
|
---|
74 | </Project>
|
---|