ClickOnce报错的解决:VS 2010 RTM returns Error: "Cannot publish because a project failed to build"

VS 2010 RTM returns Error: "Cannot publish because a project failed to build" ,even though Solution builds fine.

Original post: http://connect.microsoft.com/VisualStudio/feedback/details/551674/vs-2010-rtm-returns-error-cannot-publish-because-a-project-failed-to-build-even-though-solution-builds-fine

Failed to publish my application thru ClickOnce:

Hi everyone - 

First off, thanks for your patience with this bug. It's taken us a long while to figure this one out, but we think we've finally gotten down to the bottom of what is going on here. 

The problem started reproducing for us all the sudden in the codebase for the next version of Visual Studio. We've debugged this, and it ends up that it's a timing issue in the build system. I spoke to the engineer in charge of the MSBuild build engine, and it ends up that the same problem existed in VS 2010, with the same symptoms: publishing works when you choose Publish from the Build menu, but it doesn't work when you use the Publishing Wizard. 

The timing nature of this problem is why some of you are reporting the issue after having enabled/disabled various addins, commands, etc. It also perfectly explains why publishing stops working all the sudden, and why we've had such a hard time reproducing this issue. 

The only workaround is to choose Publish from the Build menu. The reason the workaround works is because the code path for invoking the publish operation from the Build menu is a bit different than the code path for invoking it from the wizard or the property page. The wizard/property page invocation mechanism is susceptible to the timing issue, while the invocation from the Build menu should not be subject to that. 

Choosing Publish from the Build menu will perform the publishing operation according to the last-set settings in the Publishing Wizard.

We won't be able to address this in VS 2010; however, I know the MSBuild team is working on this issue for the next release.

Thanks again for everyone's understanding,
-- Izzy

Izzy Gryko
Lead Software Design Engineer
Microsoft Visual Studio
izzyg@microsoft.com                                        




原文地址:https://www.cnblogs.com/puncha/p/3877037.html