Visual Studio 2010 access denied on “Publish”

I was getting the errors below when publishing to a file system:

Connecting to C:\inetpub\wwwroot\webapp
Transformed Web.config using Web.Debug.config into obj\Debug\TransformWebConfig\transformed\Web.config.
Copying all files to temporary location below for package/publish:
obj\Debug\Package\PackageTmp.
Publishing folder /…
Unable to add ‘Web.config’ to the Web site.  Unable to add file ‘Web.config’.  Access is denied.
Publishing folder Account…
Publishing folder bin…
Unable to add ‘bin/webapp.dll’ to the Web site.  Unable to add file ‘bin\webapp.dll’.  Access is denied.
Unable to add ‘bin/webapp.pdb’ to the Web site.  Unable to add file ‘bin\webapp.pdb’.  Access is denied.
Publishing folder Scripts…
Publishing folder Styles…
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

The fix: Open Visual Studio 2010 with “Run as Adminstrator” (right-click it and choose that option).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.