Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net46 referencing netstandard1.3: 'Could not load file or assembly 'System.IO.FileSystem, Version=4.0.1.0' #20239

Closed
discostu105 opened this issue Feb 15, 2017 · 6 comments
Milestone

Comments

@discostu105
Copy link
Contributor

Ran into a strange problem and isolated it to the following:

  • ConsoleApp (.NET 4.6, old csproj)
  • ClassLib (netstandard1.3, new csproj)
  • ClassLib uses System.IO.File
  • ConsoleApp references ClassLib

When executed, this exception flies: 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.'

Repro:
ConsoleApp:

using System;

namespace ConsoleApp6 {
	class Program {
		static void Main(string[] args) {
			Console.WriteLine("hello");
			ClassLibrary1.Class1.CreateFile();
			Console.WriteLine("world");
		}
	}
}

ClassLib:

using System.IO;

namespace ClassLibrary1 {
	public static class Class1 {
		public static void CreateFile() {
			var f = File.Create("ugl.txt");
		}
	}
}

ClassLib: (csproj):

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard1.3</TargetFramework>
  </PropertyGroup>

</Project>
@discostu105 discostu105 changed the title net46 referencing netstandard1.3: 'Could not load file or assembly 'System.IO.FileSystem, Version=4.0.1.0" net46 referencing netstandard1.3: 'Could not load file or assembly 'System.IO.FileSystem, Version=4.0.1.0' Feb 15, 2017
@discostu105
Copy link
Contributor Author

btw: something similar has been reported here: dotnet/efcore#6831 and aspnet/Hosting#801

@weshaggard
Copy link
Member

@discostu105 can you add a reference to NETStandard.Library package to your net46 console application? It is needed to get the System.IO.FileSystem assembly that is missing.

@discostu105
Copy link
Contributor Author

@weshaggard great, that solved my problem. thanks for super-fast response!

just for the record: when doing the ConsoleApp in the new csproj format (still net46), it did work without adding a reference.

@weshaggard
Copy link
Member

when doing the ConsoleApp in the new csproj format (still net46), it did work without adding a reference.

Yes in the new project system we are able to flow the NETStandard.Library package reference automatically so you don't need to do in manually but in the old system the manual referencing is still needed.

discostu105 referenced this issue in Dynatrace/superdump Feb 15, 2017
*  * added appinsights support
 * made paths configurable
 * made PathHelper a service
 * made x86 only build targets (azure only has 32-bit coreclr, o_O)

* removed unnecessary RuntimeIdentifiers

* remove AI key

* solved problem with netstandard change (see https://github.com/dotnet/corefx/issues/16206)
@dkent600
Copy link

dkent600 commented May 4, 2017

adding a reference to NETStandard.Library doesn't work for me. The problem may be slightly different. The exception looks like this:

Severity	Code	Description	Project	File	Line	Suppression State
Error	MSB4018	The "CheckFileSystemCaseSensitive" task failed unexpectedly.
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.
File name: 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at TypeScript.Tasks.CheckFileSystemCaseSensitive.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

and double-clicking on the exception message takes one to these lines in Microsoft.TypeScript.targets:

<Target Name="CheckFileSystemCaseSensitive">
    <CheckFileSystemCaseSensitive
       MSBuildThisFileFullPath="$(MSBuildThisFileFullPath)" >
      <Output TaskParameter="IsFileSystemCaseSensitive"  PropertyName="IsFileSystemCaseSensitive" />
    </CheckFileSystemCaseSensitive>
  </Target>

where it says that "MSBuildThisFileFullPath is not defined".

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.0.0 milestone Jan 31, 2020
@Dalhs-93
Copy link

@weshaggard I am getting the same error as Discostu105, I saw your response to 'can you add a reference to NETStandard.Library package to your net46 console application?' but as I am very new to Visual Studio and coding I'm not sure how to do this... Any help would be very much appreciated!

Error:

Could not load file or assembly 'CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants