Visual Studio 'Publish' command fails
Asked Answered
B

11

6

I'm working on a moderately sized WebForms project. Due to the peculiarities of management here, I have to upload the site to a remote server in order to test (no localhost testing). I'm using the 'Publish' command in Visual Studio 2008. Sometimes, it even works. Most of the time, I inexplicably get a "publish failed" in the bottom left corner, with no further details.

The few googled articles/forum posts I read suggested making the target local folder for the publish operation readable/writable for everyone. Doesn't help.

Is there are way to get further details as to WHY a publish fails in VS2008, and if not, is there a better way of doing these deployments? I'm spending more time building/pushing to the web server than actually debugging.

Brande answered 29/4, 2009 at 20:46 Comment(1)
This is stupid, so I dont think it warrants being posted as an answer but sometimes if i have the folder open and a file clicked on, the publish fails because it cant delete the file i have highlighted.Creationism
B
3

It happens to us when there is an error in markup (!). Bad thing is that VS will just swallow the error and just tell you Failed.

What I suggest is to run your publish from command line using MSBuild. It's not that straightforward but it works (once you get into it).

Buseck answered 29/4, 2009 at 21:25 Comment(0)
T
4

It's worth checking the output window. I've just had a publish fail because I had deleted an image outside of VS so VS was complaining that the image couldn't be found, but this information was only displayed in the output window.

See this link for more information: http://ericfickes.com/2009/08/find-out-why-visual-studios-publish-fails/

Tartarus answered 16/9, 2010 at 9:36 Comment(1)
Great, I have found my answer here!Binary
B
3

It happens to us when there is an error in markup (!). Bad thing is that VS will just swallow the error and just tell you Failed.

What I suggest is to run your publish from command line using MSBuild. It's not that straightforward but it works (once you get into it).

Buseck answered 29/4, 2009 at 21:25 Comment(0)
B
2

I've since discovered that the reason for these particular publish failures was due the "Delete Existing Files" option being checked. Using Visual Studio 2008 under a non-administrative account on Windows Vista could cause a permissions error while attempting to delete the existing files. The publish would fail silently after encountering a file that Visual Studio had insufficient access to delete. Once the files were deleted manually outside of Vidual Studio, the publish functioned normally.

I have not had this issue with Windows 7; I assume the UAC changes in Windows 7 fixed the problem.

Brande answered 4/11, 2009 at 5:59 Comment(0)
G
1

I mostly work with Web Forms, and I encounter this problem daily. It seems to me that publish fails when it fails to delete a file it is trying to replace. Even if I don't have any files open, it still fails sometimes. Not sure why. Not only VS publish fails very often, it is painfully slow as well. I just publish to empty local directory and use separate FTP client to upload files. It's more work, but works.

Goblin answered 1/5, 2009 at 0:43 Comment(0)
B
1

This is probably not the case for you, but I've seen this happen when I'm publishing a web site. If the app_offline.htm file is not excluded from your project (if you use this file), the publish will fail.

Brushoff answered 1/5, 2009 at 3:20 Comment(0)
H
1

Same happened to me.. what I did was include images files that was not included in the project and delete images that were not used.

Higley answered 10/12, 2009 at 12:41 Comment(0)
Q
0

After struggling with a similar issue for about 30 mins with no clue as to what was causing it closed down VS and reopened my project. Started working fine. No idea why but it worked.

Quicksilver answered 2/11, 2009 at 6:56 Comment(0)
M
0

You should always stop the IIS instance running on the machine your are publishing to. Google the word "iisreset". Other hosting providers like DiscountAsp and Arvixe offer you tools to "Stop" and "Start" your app pool on their IIS remotely. This is very necessary because IIS may have locked some files as "in use", so your publish fails when it tries to write over them. When your publish is complete, then just restart IIS (or press "Start" from a web tool if you're using a 3rd party hosting provider).

When all else fails, check your "Output" window (the tab to the right of your "Error List" at the bottom of Visual Studio). Scroll through all of it after a failed publish and look for anything that says "Unable to add". If you keep seeing the same "Unable to add" errors on the same publish, then ftp into the folder, delete the the problematic files manually, and try publishing again.

Meredi answered 13/9, 2011 at 19:40 Comment(0)
S
0

I got this when my ProjectName.Publish.xml file was read-only. Once I checked the file out of source control, I no longer got the error and could publish.

Start answered 27/11, 2013 at 13:9 Comment(0)
U
0

Just to add to this thread, I found that, for some bizarre reason, only the Mercurial files were being published to the server, everything else just wasn't being copied across.

Another strange thing was that only the Debug configuration was available; Release was nowhere to be seen.

After reading other threads around S.O., I found that there were many for VS 2010 and 2012, but not much to cover the same problem with 2008.

The fix, I found, was to delete the [solution].suo file and then attempt a publish. That seemed to do the job, though it took a long time to complete.

Uam answered 20/2, 2015 at 12:4 Comment(0)
N
0

What I found and work in my case. It is to use a different version of VS.

I recently had the problem, the solution works perfectly in VS2015 build, compile and tested.

However, when I try to publish was failing silently. enter image description here So, I closed the solution and open it with VS2017 that use the same file structure for the projects/solutions. Then rebuild it and publish without any problems.

enter image description here

I believe it could be VS related and it is complicated to debug.

This is a workaround if you work with multiple Vs instances in your local machine.

Nilotic answered 28/10, 2019 at 22:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.