When using .Net Standard 1.4 in the library and .Net framework 4.6.1 in the application and the application, it is not possible to load the file System.IO.FileSystem, Version = 4.0.1.0

I have a solution containing a library and 2 applications. Applications represent the same program, one of which is intended for installation in the Windows App Store through UAP10, and the other for PCs with Microsoft Windows using .Net Framework 4.6.1. I am using Visual Studio 2017.

  • I installed the target project of the .Net standard 1.4 library.
  • I installed the UWP targeting app on Windows 10 Universary Edition (10.0; Build 14393), Min version Windows 10 (10.0; Build 10586).
  • I installed a generic Windows targeting application .Net Framework 4.6.1.

The UWP version compiles and works fine.

Initially compiling and running .Net Framework 4.6.1. However, when I make a call to File.Open from System.IO, I get the following error message:

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 specified file. ''

The code block with File.Run is located inside the library code (.Net Standard 1.4). I am not sure what causes the problem. I thought I could use the .Net Standard 1.4 libraries in an application that references the .NET Framework 4.6.1.


As a workaround, I tried installing the Nuget package for System.IO in the .Net Framework application. System.IO Version 4.0.1.0 is not even an option. There is version 4.0.10, but it does not work when this Nuget package is installed.

, System.IO .NET Framework 4.6.1, System.IO .Net Standard 1.4?

+3
1

"" csproj, , , , , . .net(, NETStandard.Library NETStandard.Library.NETFramework ( .NET Standard 2.0)) .

, csproj .NET Framework ( , , ):

<PropertyGroup>
  <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
+3

Source: https://habr.com/ru/post/1017360/