Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdditionalFilesToRemoveFromTarget feature doesn't work when publishing from VS #61

Closed
rkeitel opened this issue Jul 15, 2019 · 18 comments
Closed
Milestone

Comments

@rkeitel
Copy link

rkeitel commented Jul 15, 2019

This feature doesn't appear to remove any files from the web root. See issue 52.

I'm using version 1.5.4 of HPP. The publishing target is the local file system. The VS project uses package references. DeleteExistingFiles is set to false. EnablePackageProcessLoggingAndAssert is set to true, but the log file AdditionalFilesToRemoveFromPublish.txt is not created in obj\Release\Package\Logs.

@richardszalay
Copy link
Owner

richardszalay commented Jul 15, 2019

Is your profile's publishUrl a file path or a web address? The feature is implicitly only supported if it's a file path

@rkeitel
Copy link
Author

rkeitel commented Jul 15, 2019

The publishUrl is a file path.

@richardszalay
Copy link
Owner

Argh, you're killing me 🤣

I'll try to take a look, but if you could create a small repro and email it to me ([email protected]) it will make diagnosing/fixing it quicker.

@rkeitel
Copy link
Author

rkeitel commented Jul 15, 2019

I can't create a repo because it is a customer project. But here you have the relevant configuration files:
Testsite.zip

@richardszalay
Copy link
Owner

richardszalay commented Jul 15, 2019

@rkeitel Thanks for raising this, I can reproduce. For what it's worth, if you enable autopublish you won't hit this problem (which is why I've never seen it before)

For now you can use the following workaround at 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" />

@richardszalay
Copy link
Owner

Summary:

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.

@rkeitel
Copy link
Author

rkeitel commented Jul 15, 2019

Cool, the workaround works great. Thank you very much :-)

@richardszalay
Copy link
Owner

Excellent. I'll keep this issue open until I release a new version with the fix.

@rkeitel
Copy link
Author

rkeitel commented Jul 15, 2019

I noted another problem. Deleting additional assemblies is working (e.g. <TargetPath>bin\Testsite.Feature.*</TargetPath>), but removing additional configs is still not working (e.g. <TargetPath>App_Config\Include\Feature\**</TargetPath>).

@richardszalay
Copy link
Owner

I'm not sure if that glob is valid. Have you tried App_Config\Include\Feature\**\*.config?

@richardszalay richardszalay changed the title AdditionalFilesToRemoveFromTarget feature isn't removing files (2) AdditionalFilesToRemoveFromTarget feature doesn't work when publishing from VS Jul 16, 2019
@rkeitel
Copy link
Author

rkeitel commented Jul 16, 2019

Yes, I tried App_Config\Include\Feature\*.config, but it is not working.

@richardszalay
Copy link
Owner

richardszalay commented Jul 16, 2019

App_Config\Include\Feature\*.config won't work unless the files aren't in any subfolders

App_Config\Include\Feature\** won't work because it will only match directories.

Can you try App_Config\Include\Feature\**\*.config ?

@rkeitel
Copy link
Author

rkeitel commented Jul 16, 2019

All files are in App_Config\Include\Feature without subfolders, so App_Config\Include\Feature\*.config should be the right one.

@richardszalay
Copy link
Owner

Interesting. Ok, let try to reproduce.

@richardszalay
Copy link
Owner

Even using your original config of App_Config\Include\Feature\** (+ the workaround I posted above), I can't actually reproduce this problem. For me, the extra config files go away when I publish via the VS dialog. I comment out the lines in Local.pubxml and reload the project (which is required, btw) then it stops doing it.

I've attached the sample project I used (which is just Helixbase with your config). Can you try it and see if you can reproduce it?

working.zip

@rkeitel
Copy link
Author

rkeitel commented Jul 18, 2019

You are right. The problem was that my App_Config folder had wrong security permissions. So all problems are solved. Thank you very much :-)

@richardszalay
Copy link
Owner

Ah good news. I'll close this issue once I've published a new version with the first fix.

@richardszalay
Copy link
Owner

Included in the v1.5.5 release

@richardszalay richardszalay added this to the 1.5.5 milestone Aug 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants