Open asteiger opened 4 years ago
I have a SPA build setup that will compile front end code differently based on the build configuration. This lets me do
dotnet publish -o publish -c Test dotnet publish -o publish -c Stage dotnet publish -o publish -c Release
for my CI pipeline and have it pull in proper runtime configs for specific environments.
However with my csproj file containing the following:
`
</Target> <Target Name="PublishRunWebpackTest" AfterTargets="PublishUpdateModules" Condition=" '$(Configuration)' == 'Test' "> <Exec WorkingDirectory="$(SpaRoot)" Command="yarn build:test" /> </Target> <Target Name="PublishRunWebpackStage" AfterTargets="PublishUpdateModules" Condition=" '$(Configuration)' == 'Stage' "> <Exec WorkingDirectory="$(SpaRoot)" Command="yarn build:stage" /> </Target> <Target Name="PublishRunWebpackRelease" AfterTargets="PublishUpdateModules" Condition=" '$(Configuration)' == 'Release' "> <Exec WorkingDirectory="$(SpaRoot)" Command="yarn build:prod" /> </Target> <Target Name="PublishCopyDist" AfterTargets="PublishRunWebpackTest;PublishRunWebpackStage;PublishRunWebpackRelease"> <ItemGroup> <DistFiles Include="$(SpaRoot)dist\**" /> <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)"> <RelativePath>%(DistFiles.Identity)</RelativePath> <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> <ExcludeFromSingleFile>true</ExcludeFromSingleFile> </ResolvedFileToPublish> </ItemGroup> </Target>`
The PublishCopyDist target only runs for the Test configuration, not Stage or Release. The individual PublishRunWebpack targets run properly according to configuration.
Hi
For the copy PublishCopyDist, have you tried changing to DependsOnTargets (instead of AfterTargets)?
I have a SPA build setup that will compile front end code differently based on the build configuration. This lets me do
dotnet publish -o publish -c Test dotnet publish -o publish -c Stage dotnet publish -o publish -c Release
for my CI pipeline and have it pull in proper runtime configs for specific environments.
However with my csproj file containing the following:
`
The PublishCopyDist target only runs for the Test configuration, not Stage or Release. The individual PublishRunWebpack targets run properly according to configuration.