15

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?

2
  • Do you have the file "ProjectName\App_Data\XmlDocument.xml" checked-in to TFS? And are you trying to overwrite the file for each build? Commented Jun 5, 2014 at 15:08
  • Yes, the file is checked in. I do want the file would get copied over to the drop folder with each build, but I would think it wouldn't need to be an overwrite since a new drop folder is created for each build. Commented Jun 5, 2014 at 15:44

3 Answers 3

16

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Had this issue today even though I worked on that project and Published a few weeks ago.
5

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.

Comments

1

Even though you are creating a new directory for each build, this directory is only for build output. The build doesn't actually occur in that directory, it occurs in the server's tfs workspace and the build output get's copied into the new directory after. The access denied error is due to the checked in file being read only when accessed by tfs on the build server work space and so the file cannot be re-generated\ overwritten during build.

I got around this issue by changing my xml documentation output path to the bin folder.

So Project-> Build -> Output Output path: bin\ XML Documentation file: bin/XmlDocument.xml

I suggest you do this for all of your build configurations (Project -> Build, Configuration Drop down menu -> Select All Configurations)

Then under Project -> Areas/ HelpPage/App_Start/HelpPageConfig.cs change config.SetDocumentationProvider to map to "~/bin/XmlDocument.xml"

Don't forget to remove the XmlDocument.xml file from source control as well since it is re-generated for every build

1 Comment

Thanks, worked for me by changing output path to bin/...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.