‘Publish…’ Resulting in Directory With No Files

I was pulling my hair out with this one…  Which isn’t good considering I have so little of it left!  I had just upgraded to the Windows Azure 1.7 SDK the day before with no problems, and used the upgraded ‘Publish…’ dialog to successfully publish a website to my hard disk for hosting on an internal development server.  However, when trying to deploy another project to my file system, it said it was successful, but there were no files in the directory.  The only difference, the first project was an Azure project, the second was a standard ASP.Net Web Application.  If you installed the Windows Azure 1.7 SDK, you may want to read this.

The Problem

At first it appears that there is no problem:

image

However you may remember that when publishing a web application, the output window will generally iterate through each of the directories as it copies the files from that directory over.  Sure enough, when looking at the output directory – there are no files, no bin directory, no nothing…

Troubleshooting

Since one site published and the other did not, I believed that the failure may have been to a failed SQL Server 2012 installation that happened between publish.  I rolled back the installation, however that did not work either. 

I also checked the Configuration Manager dialog, and ensured that the projects were selected to actually build (just checking, even though the output said it built them..)  I checked the properties of the solution and the projects, and a selection of files in the project to make sure that they were selected for content…  Nothing seemed to work.

I then decided to uninstall the Azure 1.7 SDK to see if that was the culprit.  When I opened the Windows 7 ‘Uninstall a Program’ dialog, I noticed that the Azure SDK came with 2 extra packages that just so happen to be in a Release Candidate state from Microsoft – ‘Microsoft Web Deploy 3.0’ and ‘Microsoft Web Publish – Visual Studio 2010’.  It dawned on me that the publish dialog must not be just for Azure, since it appeared when I tried to deploy the regular web application as well.  Therefore, it must have been an upgrade to the publish mechanism in Visual Studio.  I uninstalled both of the programs and received my old publish dialog once again, and was able to successfully publish the solution above as I had done before.

After celebrating solving the problem, I tried reinstalling the Azure package, to see if it would repair the publishing process. Even though it brought back the updated dialogs, it did not publish any files. Instead of uninstalling and retreating, I now KNEW what the cause was, and these were packages not just for Azure. I now knew a product name to search for.

The Solution

Sure enough, with the correct search term in Google – ‘microsoft web publish no files’, and setting the timeline to 1 week, I found what I needed - Microsoft Connect - Publish Web Application FAILS! (by Andrew Rits).

I am surprised that I missed something that ended up being so simple…  In the Configuration Manager, I had the following settings:

image

This is how I had been building and debugging the solution always…  However, apparently when installing the new Web Publishing package, it does things a little differently in its configuration for publishing:

image

You see the difference?  The configuration here is set to ‘x86’ instead of ‘Any CPU’.  Sure enough, as soon as I switched the configuration to ‘Release – Any CPU’, the deployment built and published all of my files as I expected.

Conclusion

It was a small change, but apparently the new ‘Publish web application’ defaults to the x86 configuration, thereby not copying any of the project/bin files to the publish target directory.  I spent forever trying things, but this small drop down eluded me until I was able to target that the dialog was actually working apparently, I just didn’t have the correct configuration.

I hope that this saves you the hours of frustration and hastened hair loss that it caused me…  I also hope that before Microsoft brings this publishing package out of RC status, that they change the behavior of that menu to default to the settings of the old publish menu for the first time.

Happy Coding!

Print | posted on Monday, June 11, 2012 2:20 AM

Feedback

# re: ‘Publish…’ Resulting in Directory With No Files

left by eric at 8/15/2012 5:30 AM Gravatar
thanks, you saved my day!

# re: ‘Publish…’ Resulting in Directory With No Files

left by tostringtheory at 8/28/2012 9:26 AM Gravatar
No problem! Glad that I could help.

# re: ‘Publish…’ Resulting in Directory With No Files

left by Chris at 7/3/2013 7:08 AM Gravatar
Thanks for the article. I was going crazy trying to figure this out.

# re: ‘Publish…’ Resulting in Directory With No Files

left by Robert Brower at 9/1/2014 9:15 AM Gravatar
I've seen the same solution proposed in a few different places and I've tried this but it still does not work. I created a custom build configuration called ON-TOOL based off of the Release build configuration, but when I try to publish 2 out of the 4 projects in my solution to the file system, the package directory is empty. That is, unless the build configuration and the publish configuration are actually different. I mean that if I select ON-TOOL in the build configuration drop down on the toolbar, and select Release - Any CPU in the publishing dialog, then I get files in the package directory. This is costing me literally days and causing me to lose a LOT of hair.
Post A Comment
Title:
Name:
Email:
Comment:
Verification: