Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 'Publish' command fails

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.

like image 814
JustinT Avatar asked Apr 29 '09 20:04

JustinT


People also ask

What command does Visual Studio use to Publish?

Basic command-line publishing The default publish folder format is bin\Debug\{TARGET FRAMEWORK MONIKER}\publish\. For example, bin\Debug\netcoreapp2. 2\publish\. The dotnet publish command calls MSBuild, which invokes the Publish target.

How do I Publish in Visual Studio?

To publish from Visual Studio, do the following: Change the solution configuration from Debug to Release on the toolbar to build a Release (rather than a Debug) version of your app. Right-click on the project (not the solution) in Solution Explorer and select Publish. In the Publish tab, select Publish.

What does Publish command do in CLI?

The dotnet publish command accepts MSBuild options, such as -p for setting properties and -l to define a logger. For example, you can set an MSBuild property by using the format: -p:<NAME>=<VALUE> . You can also set publish-related properties by referring to a .pubxml file. For example: .NET CLI Copy.

What is the difference between build and Publish in Visual Studio?

Build compiles the source code into a (hopefully) runnable application. Publish takes the results of the build, along with any needed third-party libraries and puts it somewhere for other people to run it.


3 Answers

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/

like image 179
Phil Hale Avatar answered Oct 04 '22 22:10

Phil Hale


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).

like image 21
Rashack Avatar answered Oct 04 '22 22:10

Rashack


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.

like image 31
JustinT Avatar answered Oct 04 '22 21:10

JustinT