troubleshooting Question

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

Avatar of IUAATech
IUAATech asked on
ASP.NET
1 Comment1 Solution341 ViewsLast Modified:
I am using Web Deployment Projects (http://msdn2.microsoft.com/en-us/library/aa479568.aspx) 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:
  <ItemGroup>
    <ExcludeFromBuild Include="$(SourceWebPhysicalPath)\Uploads\**\*.*"/>
  </ItemGroup>

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" />
  </Target>

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

Is there any better way of doing this?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros