System.IO.Abstractions: Could not load file or assembly 'System.Security.AccessControl', Version=4.1.1.0

I am unable to use any type in System.IO.Abstractions (version 8.0.3) in a test project targeting .NET Framework 4.7.2

  1. Download and extract the following project for a minimal reproduction:

FileSystemTest.zip

  1. Build the project using dotnet build
  2. Run the tests in the project dotnet test FileSystemTest\bin\Debug\net472\FileSystemTest.dll

I expect the test to pass, instead we get a FileLoadException.

**>dotnet test FileSystemTest\bin\Debug\net472\FileSystemTest.dll**

Microsoft (R) Test Execution Command Line Tool Version 16.3.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...

A total of 1 test files matched the specified pattern.
  X CanCreateFileSystem [207ms]
  Error Message:
   **System.IO.FileLoadException : Could not load file or assembly 'System.Security.AccessControl, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)**
  Stack Trace:
     at System.IO.Abstractions.FileSystem..ctor()
   at FileSystemTest.Program.CanCreateFileSystem() in c:\FileSystemTest\FileSystemTest\Program.cs:line 12

Test Run Failed.
Total tests: 1
     Failed: 1
 Total time: 1.4191 Seconds

Note: the test pass when using the old csproj format of if we change the project to be a console application.

From the assembly metadata of System.IO.Abstractions looks like is referencing System.Security.AccessControl version 4.1.1.0. However, the version of System.Security.AccessControl copied in build output is version 4.1.3.0. The latter is what the nuget package claim to depend on.

image

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 19 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for all your thoughts - I just added a net461 target (#554). New version (8.1.x) will be on NuGet.org soon.

Thanks for reporting, I’ll try to have a look this week!