158
votes

The visual studio 2012 on my PC get the following error message when preview in the "Public Web". I need to restart VS to get rid of the error message.

Invoke build failed due to exception 'Specified condition "$(PackageAsSingleFile)" evaluates to "" instead of a boolean. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets'

What caused the error?

5

5 Answers

215
votes

I'm not sure what causes it, but restarting VS 2012 fixed it for me.

45
votes

Restarting VS usually helps, but when it doesn't - try deleting .user and .suo files, as per this suggestion: https://stackoverflow.com/a/16223645/913845

This does not always work, however if you skip "Preview Deployment" it is less likely to fail.

Probably it's the solution to the entire class of evaluates to "" instead of a boolean. Visual Studio problems. Something for VS team at MS too look at?

10
votes

I've found a very very weird (and working) workaround for this type of deploy issues, if you have tried closing & opening VS with no luck, try to close all open document prior to the publish process. weird huh? :)

so the complete fix-it guide for this type of issues would be like the following:

  1. Try "Clean" then rebuild
  2. If it's still not publishing, try closing & reopening your project again
  3. Still no luck? try closing VisualStudio but this time delete all the *.user & *.suo files, then open up your solution again and give it a try.
  4. Finally if all these steps are not working, try my newest trick, close all the opened document and give it a try

let me know if this has helped you :)

1
votes

One common scenario that also raises that error is when you have files referenced on your solution that are missing.

So excluding those from the solution will fix it.

-3
votes

You need to run Visual Studio "As Administrator". The path specified requires administrative authority for writing.