Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Guy Porritt 2 posts 72 karma points
    Jan 14, 2019 @ 14:30
    Guy Porritt

    Prevent media folder being deleted when publishing from Visual Studio

    Is there anyway to prevent the media folder from being deleted when you deploy a site via the Publish functionality in Visual Studio? I know I could uncheck the "delete all files on publish", but it seems sensible to keep the files and live files as neat as possible.

    How do other people handle deployment of development once the site is live and up and running? I've seen lots about Courier and I'm using uSync, but I can't workout how to best hand deployment of the file system while maintaining the media folder.

  • Alex Skrypnyk 6112 posts 23616 karma points MVP 7x admin c-trib
    Mar 10, 2019 @ 02:46
    Alex Skrypnyk

    Hi Guy

    I struggled with the same problem, did you find a solution?



  • Guy Porritt 2 posts 72 karma points
    Mar 11, 2019 @ 15:21
    Guy Porritt


    I think I accepted that you can't tick the box 'Delete all file before publish' and that the way to do it would be to delete the file manually, taking care not to delete the media folder. Not ideal but doable. I also played with uSync, but that was for publishing the DB changes.

    So the short answer is no, but I think you can work around it. If you find a solution let me know

  • Harry Spyrou 212 posts 604 karma points
    Mar 11, 2019 @ 16:01
    Harry Spyrou

    What I usually do is I never include the Media folder in the csproj apart from the first time I deploy something on CI.

    That way I get the original Media folder and from that point on, I have Courier to transfer things for me, without touching the folder while publishing (or deploying automatically in my case).

    If you use Courier (or uSync, same difference sometimes) you could also completely ignore Media (remove from csproj) and then Have Courier or uSync create it for you (aka include those files when publishing).

    Up to you. I've seen other people including the Media folder in a private nuget server and restoring from there on publish, but to each his own I guess.

Please Sign in or register to post replies

Write your reply to: