Write
Write content to a file.
Task version: 1.6.0
Required Frends version: 5.7+
Required .NET version: 8.0
Compatible Agents: Crossplatform
Task Parameters
Content : String
Source directory.
Default: -
Example: This is test content
Path : String
Full path of the target file to be written
Default: -
Example: c:\temp\foo.txt
UseGivenUserCredentialsForRemoteConnections : Boolean
Sets a value indicating whether remote connection is used.
If set, allows you to give the user credentials to use to delete files on remote hosts.
If not set, the agent service user credentials will be used.
Note: This feature is only possible with Windows agents.
Default: False
Example: true
UserName : String
Sets username. This needs to be of format domain\username.
Default: "domain\username"
Example: domain\username
🗝Password : String
Sets password for the used credentials.
Default: -
Example: testpwd
FileEncoding : FileEncoding
Sets encoding for the written content. By selecting 'Other' you can use any encoding.
Possible values:
UTF8: Sets encoding for the written content. By selecting 'Other' you can use any encoding.Default: Sets encoding for the written content. By selecting 'Other' you can use any encoding.ASCII: Sets encoding for the written content. By selecting 'Other' you can use any encoding.Unicode: Sets encoding for the written content. By selecting 'Other' you can use any encoding.Windows1252: Sets encoding for the written content. By selecting 'Other' you can use any encoding.Other: Sets encoding for the written content. By selecting 'Other' you can use any encoding.
Default: UTF8
Example: FileEncoding.UTF8
EnableBom : Boolean
Sets a value indicating whether enablation BOM for UTF-8.
Default: False
Example: true
EncodingInString : String
Sets file encoding to be used. A partial list of possible encodings: https://en.wikipedia.org/wiki/Windows_code_page#List.
Default: -
Example: ISO-8859-2
WriteBehaviour : WriteBehaviour
Sets write behaviour.
How the file write should work if a file with the new name already exists.
Possible values:
Append: Throw an error and roll back all transfers.Overwrite: Overwrite the target file.Throw: Rename the transferred file by appending a number to the end.
Default: Throw
Example: WriteBehaviour.Throw
ThrowErrorOnFailure : Boolean
Whether to throw an error on failure.
Default: True
Example: true
ErrorMessageOnFailure : String
Overrides the error message on failure. If ThrowErrorOnFailure is set to true, then the original exception will be wrapped in a new Exception with this error message.
Default: -
Example: Writing the file failed: target folder missing
Task Result
Success : Boolean
Indicates whether the write completed successfully.
Example: true
Path : String
Full path to the file.
Example: c:\temp\foo.txt
SizeInMegaBytes : Double
Size of the written file in mega bytes.
Example: 32
SizeInKiloBytes : Double
Size of the written file in kilo bytes.
Example: 32
SizeInBytes : Double
Size of the written file in bytes.
Example: 32
Error : Error
Error details. Null when Success is true.
Example: null
Error.Message : String
Summary of the error.
Example: Unable to write the file.
Error.AdditionalInfo : Object
The exception that caused the error.
Example: System.IO.IOException: File already exists
Task Changelog
Changelog for Task Frends.Files.Write.
[1.6.0] - 2026-10-14
Changed
Upgraded the Task to target .NET 8.
The Task now accepts a cancellation token and returns
SuccessandErrorin the result.Added
ThrowErrorOnFailureandErrorMessageOnFailureoptions to control how failures are reported.
[1.5.0] - 2026-06-23
Fixed
Fix stale reads on network storage writes.
[1.4.0] - 2025-11-04
Fixed
Returning correct file size
[1.3.0] - 2025-06-05
Fixed
Resolve issue with an unsupported library in .net 6.
Changed
Downgrade package System.Text.Encoding.CodePages from 9.0.3 to 8.0.0
Remove unused package Microsoft.Extensions.FileSystemGlobbing
[1.2.0] - 2025-03-19
Changed
Update packages: Microsoft.Extensions.FileSystemGlobbing 7.0.0 -> 9.0.3 System.ComponentModel.Annotations 4.7.0 -> 5.0.0 System.DirectoryServices 7.0.0 -> 8.0.0 System.Text.Encoding.CodePages 8.0.0 -> 9.0.3 coverlet.collector 3.1.0 -> 6.0.4 Microsoft.NET.Test.Sdk 16.6.1 -> 17.13.0 MSTest.TestAdapter 2.2.7 -> 3.8.3 MSTest.TestFramework 2.2.8 -> 3.8.3 nunit 3.12.0 -> 4.3.2 NUnit3TestAdapter 3.17.0 -> 5.0.0
[1.1.0] - 2024-10-14
Fixed
Renamed ANSI encoding to Default.
Added
Added result properties SizeInKiloBytes and SizeInBytes.
[1.0.1] - 2024-02-27
Added
Windows-1252 added to "Encoding" options.
[1.0.0] - 2023-02-15
Added
Initial implementation
Last updated
Was this helpful?

