Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Access is denied" on build server when deploying Web API project with XML documentation

In order to generate XML documentation using Web API Help Pages for my Web API project, I had to check the "XML documentation file" option under the "Builds" section of my project's properties. This correctly generates the documentation when I build locally.

However, when I check in, I get the following error on the build server:

CSC: Error generating XML documentation file 'c:\Builds\3...\Sources\CurrentVersion...\ProjectName\App_Data\XmlDocument.xml' ('Access is denied. ')

I'm not sure why this happens, since it creates a new directory for each build anyway. I googled this issue and searched Stack Overflow, but the only solutions I found were to remove the XML documentation file (which defeats the purpose of using Web API Help Pages). How can I resolve this?

like image 595
mayabelle Avatar asked Jun 04 '14 21:06

mayabelle


2 Answers

If the XML file is checked-in to TFS then when TFS gets the files to the workspace on the build server, it will have "Read-Only attribute" associated with the file. Now when the build generates the new XML file, it wont be able to overwrite the old XML file since it has the read-only attribute.

Solution is to: a) use your build scripts to modify the file attribute and make it read-write b) remove the xml file checked-in to TFS so that, build will be able to generate the XML easily.

Update: if you are using solution b, if the file is part of you project file make sure that you remove the file from the csproj file as well.

like image 112
Isaiah4110 Avatar answered Nov 02 '22 00:11

Isaiah4110


Removing the file from Source Control did not fix it for me, Team Server was still trying to access it.

I was able to solve it by Cloaking App_Data in the build definition.

like image 5
Alex Fairchild Avatar answered Nov 02 '22 00:11

Alex Fairchild