DocSite Deployment read-only files

Topics: DocSites, General Questions
Dec 2, 2008 at 5:19 PM
We're having an issue with DocSite deployment to an intranet shared folder. It appears that after a successful deployment, the files deployed are set to be read-only, any subsequent re-deployment then fails unless the files are browsed to and manually set to read-write beforehand.

Is there any configuration setting to prevent this happening?
Dec 2, 2008 at 8:25 PM
Hi,

There isn't currently an option that will change the read-only flag of deployed files.  One solution is to add a dynamic build step that will remove all of the read-only flags on files in the target directory before deployment.

  1. Open your project's Build Process Component file (BuildProcess.cs|vb).
  2. Add references to DaveSexton.DocProject.Sandcastle.dll and DaveSexton.DocProject.DeploymentSandcastle.dll (commonly found in, C:\Program Files\Dave Sexton\DocProject\bin)
  3. Append the following code to the BuildStarting method (sorry for lack of formatting but I'm in a hurry right now):

DeploymentSandcastleProjectOptions

 

options =

 

(

DeploymentSandcastleProjectOptions) context.Engine.Options;

 

 

 

if

 

(options.DeploymentEnabled)

 

{

 

base.InsertBeforeBuildStep("Deployment",

 

 

"Remove read-only flag on target files", false, false, true,

 

 

delegate(BuildContext stepContext)

 

{

 

string target = options.DeploymentLocation.LocalPath;

 

stepContext.TraceLine();

stepContext.TraceLine(

"Searching in:");

 

stepContext.TracePathLine(target);

stepContext.TraceLine();

 

SystemPath path = new SystemPath(target, false, true);

 

 

foreach (System.IO.FileInfo file in path.GetFileInfos("*.*", true))

 

{

 

if (file.IsReadOnly)

 

{

stepContext.TraceLine(

"Found read-only file: {0}", file.FullName);

 

file.IsReadOnly =

false;

 

}

}

stepContext.TraceLine(

"Done.");

 

});

}

- Dave
Dec 3, 2008 at 10:54 AM
Thanks for the workaround Dave, works like a charm :)