|
1 | 1 | <Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web"> |
| 2 | + |
2 | 3 | <PropertyGroup> |
3 | | - <TargetFramework>netcoreapp2.0</TargetFramework> |
| 4 | + <TargetFramework Condition="'$(TargetFrameworkOverride)' == ''">netcoreapp2.0</TargetFramework> |
| 5 | + <TargetFramework Condition="'$(TargetFrameworkOverride)' != ''">TargetFrameworkOverride</TargetFramework> |
4 | 6 | <TypeScriptCompileBlocked>true</TypeScriptCompileBlocked> |
| 7 | + <TypeScriptToolsVersion>Latest</TypeScriptToolsVersion> |
5 | 8 | <IsPackable>false</IsPackable> |
6 | 9 | </PropertyGroup> |
7 | | - <ItemGroup> |
8 | | - <!-- New Meta Package has SpaServices in It --> |
| 10 | + |
| 11 | + <ItemGroup Condition="'$(TargetFrameworkOverride)' == ''"> |
9 | 12 | <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" /> |
| 13 | + </ItemGroup> |
| 14 | + <ItemGroup Condition="'$(TargetFrameworkOverride)' != ''"> |
| 15 | + <PackageReference Include="Microsoft.AspNetCore" Version="2.0.0" /> |
| 16 | + <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0" /> |
| 17 | + <PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="2.0.0" /> |
| 18 | + <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" /> |
| 19 | + </ItemGroup> |
| 20 | + <ItemGroup> |
10 | 21 | <PackageReference Include="NETStandard.Library" Version="2.0.0" /> |
11 | 22 | <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0" /> |
12 | 23 | <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.0.0" /> |
13 | 24 | <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" /> |
14 | 25 | </ItemGroup> |
15 | | - <ItemGroup> |
16 | | - <!-- Files not to show in IDE --> |
17 | | - <None Remove="yarn.lock" /> |
18 | | - <Content Remove="wwwroot\dist\**" /> |
19 | | - <None Remove="Client\dist\**" /> |
20 | | - <Content Remove="coverage\**" /> |
21 | 26 |
|
22 | | - <!-- Files not to publish (note that the 'dist' subfolders are re-added below) --> |
23 | | - <Content Remove="Client\**" /> |
| 27 | + <ItemGroup> |
| 28 | + <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" /> |
24 | 29 | </ItemGroup> |
| 30 | + |
25 | 31 | <ItemGroup> |
26 | | - <Content Include="Client\tsconfig.browser.json" /> |
27 | | - <Content Include="Client\tsconfig.server.aot.json" /> |
28 | | - <Content Include="Client\tsconfig.server.json" /> |
| 32 | + <!-- Files not to publish (note that the 'dist' subfolders are re-added below) --> |
| 33 | + <Content Remove="ClientApp\**" /> |
29 | 34 | </ItemGroup> |
30 | | - <Target Name="RunWebpack" AfterTargets="ComputeFilesToPublish"> |
| 35 | + |
| 36 | + <!--/-:cnd:noEmit --> |
| 37 | + <Target Name="DebugRunWebpack" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('wwwroot\dist') "> |
| 38 | + <!-- Ensure Node.js is installed --> |
| 39 | + <Exec Command="node --version" ContinueOnError="true"> |
| 40 | + <Output TaskParameter="ExitCode" PropertyName="ErrorCode" /> |
| 41 | + </Exec> |
| 42 | + <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." /> |
| 43 | + |
| 44 | + <!-- In development, the dist files won't exist on the first run or when cloning to |
| 45 | + a different machine, so rebuild them if not already present. --> |
| 46 | + <Message Importance="high" Text="Performing first-run Webpack build..." /> |
| 47 | + <Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js" /> |
| 48 | + <Exec Command="node node_modules/webpack/bin/webpack.js" /> |
| 49 | + </Target> |
| 50 | + <!--/+:cnd:noEmit --> |
| 51 | + |
| 52 | + <Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish"> |
31 | 53 | <!-- As part of publishing, ensure the JS resources are freshly built in production mode --> |
32 | 54 | <Exec Command="npm install" /> |
33 | | - <Exec Command="node node_modules/webpack/bin/webpack.js --env.aot --env.client" /> |
34 | | - <Exec Command="node node_modules/webpack/bin/webpack.js --env.aot --env.server" /> |
| 55 | + <Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" /> |
| 56 | + <Exec Command="node node_modules/webpack/bin/webpack.js --env.prod" /> |
| 57 | + |
35 | 58 | <!-- Include the newly-built files in the publish output --> |
36 | 59 | <ItemGroup> |
37 | | - <DistFiles Include="wwwroot\dist\**; Client\dist\**" /> |
| 60 | + <DistFiles Include="wwwroot\dist\**; ClientApp\dist\**" /> |
38 | 61 | <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)"> |
39 | 62 | <RelativePath>%(DistFiles.Identity)</RelativePath> |
40 | 63 | <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> |
41 | 64 | </ResolvedFileToPublish> |
42 | 65 | </ItemGroup> |
43 | 66 | </Target> |
44 | | - <Target Name="CleanDist" AfterTargets="Clean"> |
45 | | - <ItemGroup> |
46 | | - <FilesToDelete Include="Client\dist\**; wwwroot\dist\**" /> |
47 | | - </ItemGroup> |
48 | | - <Delete Files="@(FilesToDelete)" /> |
49 | | - <RemoveDir Directories="Client\dist; wwwroot\dist" /> |
50 | | - </Target> |
| 67 | + |
51 | 68 | </Project> |
0 commit comments