source: Farmatiko/Farmatiko.csproj@ 42e2397

Last change on this file since 42e2397 was 822c59d, checked in by DimitarSlezenkovski <dslezenkovski@…>, 4 years ago

Initial commit

  • Property mode set to 100644
File size: 2.7 KB
Line 
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.3" />
17 </ItemGroup>
18
19 <ItemGroup>
20 <!-- Don't publish the SPA source files, but do show them in the project files list -->
21 <Content Remove="$(SpaRoot)**" />
22 <None Remove="$(SpaRoot)**" />
23 <None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
24 </ItemGroup>
25
26 <Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
27 <!-- Ensure Node.js is installed -->
28 <Exec Command="node --version" ContinueOnError="true">
29 <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
30 </Exec>
31 <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." />
32 <Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
33 <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
34 </Target>
35
36 <Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
37 <!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
38 <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
39 <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod" />
40 <Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
41
42 <!-- Include the newly-built files in the publish output -->
43 <ItemGroup>
44 <DistFiles Include="$(SpaRoot)dist\**; $(SpaRoot)dist-server\**" />
45 <DistFiles Include="$(SpaRoot)node_modules\**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
46 <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
47 <RelativePath>%(DistFiles.Identity)</RelativePath>
48 <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
49 <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
50 </ResolvedFileToPublish>
51 </ItemGroup>
52 </Target>
53
54</Project>
Note: See TracBrowser for help on using the repository browser.