I am trying to publish my project from my development machine to the staging environment. I would right click the project in visual studio and click publish. Most of the files would publish just fine, but a few were giving me problems. In the output log, there were multiple error messages, all stating:
Unable to add ‘XXX.ext’ to the Web site. Unable to add file ‘XXX.ext’. Access is denied.
Each XXX.ext would be a different file. What I learned after browsing and searching Google is to make sure the files on the production (or target) server are not marked as Read Only. The solution was to:
1. Go to the Publish directory
2. Highlight all files and folders
3. Right click and select Properties
4. Make sure the Read-only attribute checkbox is unchecked (white and not gray or checked). To be sure I checked the read only attribute, applied it, then unchecked it.
That was it. On the next publish, there were no errors.