Wednesday, November 20, 2019

Azure Pipelines Error: Could not load file or assembly 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

An angular project deployed through Azure DevOps pipeline would throw this error in the release pipeline:




 ##[error]System.Management.Automation.MethodInvocationException: Exception calling "Transform" with "4" argument(s): "Could not load file or assembly 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified." ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.



The error was thrown in a 'Config transformation' task. I tried to install file system package using
Install System.IO.FileSystem -Version 4.0.1


in a Powershell task and also tried to install dot net framework 4.6 using

Install DotNetFramework.Runtime -Version 4.6.1

in a custom Nuget task, but both these methods didn't solve the issue.

Finally after going through the task history realized that the task was auto updated to latest version which has caused this issue.

So simply changing this task's version from 2.* to 1.* solved this problem. This behavior is kind of expected since a major version includes some breaking changes by convention.

No comments:

SSL Error - The connection for this site is not secure

 After cloning a git repo of dot net framework website and trying to run it all I could see was this error Turns out the fix was to simply e...