damodar
damodar

Reputation: 3

slowcheetah.transformtask task failed unexpectedly.system.unauthorizedaccessexception



Getting following error when using custom json configuration file.
Severity Code Description Project File Line Suppression State Error The "SlowCheetah.TransformTask" task failed unexpectedly. System.UnauthorizedAccessException: Access to the path 'D:\Data\…\Settings.Release.json' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at Microsoft.VisualStudio.Jdt.JsonTransformation..ctor(String transformFile, IJsonTransformationLogger logger) at Microsoft.VisualStudio.SlowCheetah.JsonTransformer.Transform(String sourcePath, String transformPath, String destinationPath) at Microsoft.VisualStudio.SlowCheetah.TransformTask.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() OzCruisingHangfireAgent.Program

Best Regards,
Damodar

Upvotes: 0

Views: 2818

Answers (1)

Rami A.
Rami A.

Reputation: 10582

This is a known issue.

The JSON transformer in SlowCheetah v3.1.66 doesn't support the source or transform files being read-only yet.

See the following issues:
https://github.com/Microsoft/slow-cheetah/issues/86
https://github.com/Microsoft/json-document-transforms/issues/16

The merged PR#17 has a fix for Microsoft.VisualStudio.Jdt, but it hasn't been released yet.

Here are a few work arounds:

  1. Make all files writeable when checking out of source control.
  2. Call the Attrib MSBuild task before the transformation to remove the read-only file attribute.

For example:

<Attrib Files="D:\Data\…\Settings.Release.json" Normal="true"/>

  1. Call the Exec MSBuild task before the transformation to remove the read-only file attribute.

For example:

<Exec Command="attrib -R &quot;D:\Data\…\Settings.Release.json&quot;"/>

Upvotes: 3

Related Questions