views:

97

answers:

2

When I do a 'Publish' on my ASP.NET MVC website, I'm finding unnecessary empty folders in the publish folder.

This is annoying because I have to manually delete them so they don't get uploaded through FTP.

This happens even when I select the following radio-buttons:

  • Delete all existing files prior to publish
  • Copy
    • Only files needed to run this application

It doesn't copy every folder, only one or two random folders. I have no idea why it chooses to copy just these folders, but not the others. They're not system-folders or anything - I made them myself.

Why is this happening?

A: 

It's just the way the publish wizard works. If you want more control over how a web project is deployed you can make a web deployment project if you have developer edition of Visual Studio. (Perhaps professional as well I'm not sure.)

Looks like you might be able to download it too?
http://www.microsoft.com/downloads/details.aspx?FamilyId=0AA30AE8-C73B-4BDD-BB1B-FE697256C459&displaylang=en

Spencer Ruport
"It's just the way the publish wizard works." - but it does delete most of the unused folders. It only leaves one or two folders in there, which aren't significant folders. (I created them myself). I highly doubt it's just selecting *random* folders. So my question is, what is the means by which is chooses folders to leave?
jonathanconway
A: 

The Publish Wizard seems to include empty root-level custom folders if they contain subfolders that also contain code. Example:

--Folder1 -+
           +- ParentClass.cs 
           +- Subfolder2 -+
                          +- ChildClass1.cs
                          +- ChildClass2.cs

Will result in an empty "Folder1" showing up in the location you publish to. I think this is an artifact of the "Namespace Provider" property on folders and the <Compile Include="Folder1\Subfolder2\ChildClass1.cs" /> elements of the csproj file.

Kelly Adams