Skip to content

Commit 59526ff

Browse files
Update templates' csproj files to fix first-time publishing (previously, it didn't deploy dist files if they were not already on disk)
1 parent 8c456aa commit 59526ff

File tree

5 files changed

+59
-28
lines changed

5 files changed

+59
-28
lines changed

templates/Angular2Spa/Angular2Spa.csproj

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PreserveCompilationContext>true</PreserveCompilationContext>
77
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
88
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
9-
<GlobalExclude>$(GlobalExclude);bin\**;obj\**;node_modules\**;**\*.user;**\*.suo;**\*.*proj</GlobalExclude>
9+
<GlobalExclude>$(GlobalExclude);bin\**;obj\**;node_modules\**;**\*.user;**\*.suo;**\*.*proj;.git\**</GlobalExclude>
1010
</PropertyGroup>
1111
<ItemGroup>
1212
<None Include="**\*" Exclude="$(GlobalExclude)"/>
@@ -68,21 +68,23 @@
6868
<!-- Files not to show in IDE -->
6969
<None Remove=".bowerrc" />
7070
<None Remove="yarn.lock" />
71-
</ItemGroup>
72-
<ItemGroup>
73-
<!-- Only publish ClientApp\dist\**, but tell IDE to show all of ClientApp\** in Solution Explorer -->
71+
72+
<!-- Files not to publish (note that the 'dist' subfolders are re-added below) -->
7473
<Content Remove="ClientApp\**" />
75-
<Content Include="ClientApp\**" Exclude="ClientApp\dist\**">
76-
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
77-
</Content>
78-
<Content Include="ClientApp\dist\**">
79-
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
80-
</Content>
8174
</ItemGroup>
82-
<Target Name="RunWebpack" AfterTargets="PrepareForPublish">
75+
<Target Name="RunWebpack" AfterTargets="ComputeFilesToPublish">
8376
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
8477
<Exec Command="npm install" />
8578
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" />
8679
<Exec Command="node node_modules/webpack/bin/webpack.js --env.prod" />
80+
81+
<!-- Include the newly-built files in the publish output -->
82+
<ItemGroup>
83+
<DistFiles Include="wwwroot\dist\**; ClientApp\dist\**" />
84+
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
85+
<RelativePath>%(DistFiles.Identity)</RelativePath>
86+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
87+
</ResolvedFileToPublish>
88+
</ItemGroup>
8789
</Target>
8890
</Project>

templates/AureliaSpa/Aurelia.csproj

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PreserveCompilationContext>true</PreserveCompilationContext>
77
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
88
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
9-
<GlobalExclude>$(GlobalExclude);bin\**;obj\**;node_modules\**;**\*.user;**\*.suo;**\*.*proj</GlobalExclude>
9+
<GlobalExclude>$(GlobalExclude);bin\**;obj\**;node_modules\**;**\*.user;**\*.suo;**\*.*proj;.git\**</GlobalExclude>
1010
</PropertyGroup>
1111
<ItemGroup>
1212
<None Include="**\*" Exclude="$(GlobalExclude)"/>
@@ -69,10 +69,19 @@
6969
<None Remove=".bowerrc" />
7070
<None Remove="yarn.lock" />
7171
</ItemGroup>
72-
<Target Name="RunWebpack" AfterTargets="PrepareForPublish">
72+
<Target Name="RunWebpack" AfterTargets="ComputeFilesToPublish">
7373
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
7474
<Exec Command="npm install" />
7575
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" />
7676
<Exec Command="node node_modules/webpack/bin/webpack.js --env.prod" />
77+
78+
<!-- Include the newly-built files in the publish output -->
79+
<ItemGroup>
80+
<DistFiles Include="wwwroot\dist\**" />
81+
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
82+
<RelativePath>%(DistFiles.Identity)</RelativePath>
83+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
84+
</ResolvedFileToPublish>
85+
</ItemGroup>
7786
</Target>
7887
</Project>

templates/KnockoutSpa/KnockoutSpa.csproj

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PreserveCompilationContext>true</PreserveCompilationContext>
77
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
88
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
9-
<GlobalExclude>$(GlobalExclude);bin\**;obj\**;node_modules\**;**\*.user;**\*.suo;**\*.*proj</GlobalExclude>
9+
<GlobalExclude>$(GlobalExclude);bin\**;obj\**;node_modules\**;**\*.user;**\*.suo;**\*.*proj;.git\**</GlobalExclude>
1010
</PropertyGroup>
1111
<ItemGroup>
1212
<None Include="**\*" Exclude="$(GlobalExclude)"/>
@@ -69,10 +69,19 @@
6969
<None Remove=".bowerrc" />
7070
<None Remove="yarn.lock" />
7171
</ItemGroup>
72-
<Target Name="RunWebpack" AfterTargets="PrepareForPublish">
72+
<Target Name="RunWebpack" AfterTargets="ComputeFilesToPublish">
7373
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
7474
<Exec Command="npm install" />
7575
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" />
7676
<Exec Command="node node_modules/webpack/bin/webpack.js --env.prod" />
77+
78+
<!-- Include the newly-built files in the publish output -->
79+
<ItemGroup>
80+
<DistFiles Include="wwwroot\dist\**" />
81+
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
82+
<RelativePath>%(DistFiles.Identity)</RelativePath>
83+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
84+
</ResolvedFileToPublish>
85+
</ItemGroup>
7786
</Target>
7887
</Project>

templates/ReactReduxSpa/ReactReduxSpa.csproj

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PreserveCompilationContext>true</PreserveCompilationContext>
77
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
88
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
9-
<GlobalExclude>$(GlobalExclude);bin\**;obj\**;node_modules\**;**\*.user;**\*.suo;**\*.*proj</GlobalExclude>
9+
<GlobalExclude>$(GlobalExclude);bin\**;obj\**;node_modules\**;**\*.user;**\*.suo;**\*.*proj;.git\**</GlobalExclude>
1010
</PropertyGroup>
1111
<ItemGroup>
1212
<None Include="**\*" Exclude="$(GlobalExclude)"/>
@@ -68,21 +68,23 @@
6868
<!-- Files not to show in IDE -->
6969
<None Remove=".bowerrc" />
7070
<None Remove="yarn.lock" />
71-
</ItemGroup>
72-
<ItemGroup>
73-
<!-- Only publish ClientApp\dist\**, but tell IDE to show all of ClientApp\** in Solution Explorer -->
71+
72+
<!-- Files not to publish (note that the 'dist' subfolders are re-added below) -->
7473
<Content Remove="ClientApp\**" />
75-
<Content Include="ClientApp\**" Exclude="ClientApp\dist\**">
76-
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
77-
</Content>
78-
<Content Include="ClientApp\dist\**">
79-
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
80-
</Content>
8174
</ItemGroup>
82-
<Target Name="RunWebpack" AfterTargets="PrepareForPublish">
75+
<Target Name="RunWebpack" AfterTargets="ComputeFilesToPublish">
8376
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
8477
<Exec Command="npm install" />
8578
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" />
8679
<Exec Command="node node_modules/webpack/bin/webpack.js --env.prod" />
80+
81+
<!-- Include the newly-built files in the publish output -->
82+
<ItemGroup>
83+
<DistFiles Include="wwwroot\dist\**; ClientApp\dist\**" />
84+
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
85+
<RelativePath>%(DistFiles.Identity)</RelativePath>
86+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
87+
</ResolvedFileToPublish>
88+
</ItemGroup>
8789
</Target>
8890
</Project>

templates/ReactSpa/ReactSpa.csproj

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PreserveCompilationContext>true</PreserveCompilationContext>
77
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
88
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
9-
<GlobalExclude>$(GlobalExclude);bin\**;obj\**;node_modules\**;**\*.user;**\*.suo;**\*.*proj</GlobalExclude>
9+
<GlobalExclude>$(GlobalExclude);bin\**;obj\**;node_modules\**;**\*.user;**\*.suo;**\*.*proj;.git\**</GlobalExclude>
1010
</PropertyGroup>
1111
<ItemGroup>
1212
<None Include="**\*" Exclude="$(GlobalExclude)"/>
@@ -69,10 +69,19 @@
6969
<None Remove=".bowerrc" />
7070
<None Remove="yarn.lock" />
7171
</ItemGroup>
72-
<Target Name="RunWebpack" AfterTargets="PrepareForPublish">
72+
<Target Name="RunWebpack" AfterTargets="ComputeFilesToPublish">
7373
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
7474
<Exec Command="npm install" />
7575
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js --env.prod" />
7676
<Exec Command="node node_modules/webpack/bin/webpack.js --env.prod" />
77+
78+
<!-- Include the newly-built files in the publish output -->
79+
<ItemGroup>
80+
<DistFiles Include="wwwroot\dist\**" />
81+
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
82+
<RelativePath>%(DistFiles.Identity)</RelativePath>
83+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
84+
</ResolvedFileToPublish>
85+
</ItemGroup>
7786
</Target>
7887
</Project>

0 commit comments

Comments
 (0)