richardszalay / helix-publishing-pipeline

Unified publishing for Sitecore Helix solutions that extends existing Visual Studio and command line workflows
MIT License
68 stars 18 forks source link

CollectAdditionalFilesToRemoveFromTarget not working within VS2019 #62

Closed richardszalay closed 5 years ago

richardszalay commented 5 years ago

As raised by @rkeitel in #61, when expicitly publishing within VS the IDE's internal optimisations mean that a number of targets don't get run. Since appears to include WebFileSystemPublish, CollectAdditionalFilesToRemoveFromTarget never runs.

I think this hasn't been raised before because autopublish is not affected by it since it runs the targets by name. Still, we should create a new ticket that verifies each of the features when publishing from within VS.

For anyone facing this, you can add the following workaround to the end of your Local.pubxml:

<!-- Temporary workaround for https://github.com/richardszalay/helix-publishing-pipeline/issues/62 -->
<Target Name="_CollectAdditionalFilesToRemoveFromTarget"
        Condition="'$(BuildingInsideVisualStudio)' == 'true'"
        DependsOnTargets="CollectAdditionalFilesToRemoveFromTarget"
        BeforeTargets="_CopyWebApplication" />