how to exclude folder (on the production site) using Web Deployment Projects

Posted on 2007-07-30
Last Modified: 2011-09-20
I am using Web Deployment Projects ( to publish my website. It seems to work great so far. However, I ran into a problem I haven't been able to solve.

I have a "Uploads" folder (with subdirectories) where I allow users to upload files.

When I publish my site, I want to tell Web Deployment Projects to leave the "Uploads" folder on my production site alone since I don't want to overwrite the files that users have uploaded.

How can I accomplish this?

I tried the following:
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\Uploads\**\*.*"/>

However, this simply deletes the "Uploads" folder on my production site and doesn't publish the "Uploads" folder from my project.

I then came across the following:

  <Target Name="AfterBuild">
    <MakeDir Directories="$(TargetDir)\Uploads" />

I believe this will simply delete the "Uploads" directory and recreate it.

Is there any better way of doing this?
Question by:IUAATech
    1 Comment
    LVL 18

    Accepted Solution

    Apparently there is no real way to "ignore" folders from the remote server.  The ExcludeFromBuild is intended to prevent test and other non-production files to be included, and that's why it removes them from the remote server.

    I suggest deploying to an intermediary folder, and then copying from there.  You can create a batch file or some sort of script to automate this.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    This video discusses moving either the default database or any database to a new volume.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now