I have a solution that contains a library and 2 applications. The applications represent the same program, with one built to target the Windows App Store through UAP10 and the other built to target a Microsoft Windows PC using .Net Framework 4.6.1. I'm using Visual Studio 2017.
- I set the library project target .Net standard 1.4.
- I set the UWP application to target Windows 10 Aniversary Edition (10.0; Build 14393), Min version Windows 10 (10.0; Build 10586).
- I set the generic Windows application to target .Net Framework 4.6.1.
The UWP version compiles and runs fine.
Initially, the .Net Framework 4.6.1 compiles and runs. 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 file specified.'
The code block with File.Run is within the library code (.Net Standard 1.4). I'm not sure what is causing the problem. I thought that I could use .Net Standard 1.4 libraries within an application that references .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 a version 4.0.10, but it doesn't work when this Nuget package is installed.
So, how do I properly reference System.IO operations within a .Net Framework 4.6.1 application that references the System.IO code within a .Net Standard 1.4 library?