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

The "CheckFileSystemCaseSensitive" task failed unexpectedly, Could not load file or assembly 'System.IO.FileSystem #15664

Closed
rainersigwald opened this issue May 8, 2017 · 14 comments
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@rainersigwald
Copy link
Member

From @dkent600 on May 4, 2017 21:48

To my Visual Studio 2017, ASP.NET Core, MVC web project I just added the Microsoft.TypeScript.MSBuild NuGet package v2.3.1, and simultaneously updated my ASP.NET Core assemblies from 1.0.* to 1.1.1. Now suddenly when I build my project I get the following exception:

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()

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

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

where it says that "MSBuildThisFileFullPath is not defined".

I've tried adding references to NETStandard.Library, as suggested here: https://github.com/dotnet/corefx/issues/16206, but that doesn't make any difference.

The diagnostic MSBuild output looks like this:

1>Target "CheckFileSystemCaseSensitive" in file "C:\Users\dkent\.nuget\packages\microsoft.typescript.msbuild\2.3.1\tools\netstandard1.3\Microsoft.TypeScript.targets":
1>  Using "CheckFileSystemCaseSensitive" task from assembly "C:\Users\dkent\.nuget\packages\microsoft.typescript.msbuild\2.3.1\tools\netstandard1.3\TypeScript.Tasks.dll".
1>  Task "CheckFileSystemCaseSensitive"
1>    Task Parameter:MSBuildThisFileFullPath=C:\Users\dkent\.nuget\packages\microsoft.typescript.msbuild\2.3.1\tools\netstandard1.3\Microsoft.TypeScript.targets
1>    [...]\.nuget\packages\microsoft.typescript.msbuild\2.3.1\tools\netstandard1.3\Microsoft.TypeScript.targets(172,5): error MSB4018: The "CheckFileSystemCaseSensitive" task failed unexpectedly.
1>    [...]\.nuget\packages\microsoft.typescript.msbuild\2.3.1\tools\netstandard1.3\Microsoft.TypeScript.targets(172,5): error MSB4018: 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.
1>    [...]\.nuget\packages\microsoft.typescript.msbuild\2.3.1\tools\netstandard1.3\Microsoft.TypeScript.targets(172,5): error MSB4018: File name: 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
1>    [...]\.nuget\packages\microsoft.typescript.msbuild\2.3.1\tools\netstandard1.3\Microsoft.TypeScript.targets(172,5): error MSB4018:    at TypeScript.Tasks.CheckFileSystemCaseSensitive.Execute()
1>    [...]\.nuget\packages\microsoft.typescript.msbuild\2.3.1\tools\netstandard1.3\Microsoft.TypeScript.targets(172,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>    [...]\.nuget\packages\microsoft.typescript.msbuild\2.3.1\tools\netstandard1.3\Microsoft.TypeScript.targets(172,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
1>  Done executing task "CheckFileSystemCaseSensitive" -- FAILED.

Copied from original issue: dotnet/msbuild#2061

@rainersigwald
Copy link
Member Author

From @dkent600 on May 4, 2017 21:50

I note, for what it's worth, that the latest version of System.IO.FileSystem is 4.3.0, not 4.0.1.0. But installing 4.0.1.0 to my project makes no difference.

@rainersigwald
Copy link
Member Author

From @dkent600 on May 4, 2017 22:48

Is there at least a work-around for this?

@rainersigwald
Copy link
Member Author

From @dkent600 on May 6, 2017 21:47

More info:

If I delete the "obj" folder in the root of the project, then the build succeeds until I close and restart Visual Studio. Rebuilding after restarting Visual Studio then again hits the error. I can delete the obj folder and again the error disappears.

Rebuild Solution makes no difference, nor does Clean Solution or closing and reopening either the project or the solution.

@rainersigwald
Copy link
Member Author

From @AnsonWooBizCloud on May 7, 2017 4:21

I hit this error too, and your workaround works for me (delete the obj folder), thank you!
I hope Microsoft will fixed it soon, quite annoying

@rainersigwald
Copy link
Member Author

rainersigwald commented May 8, 2017

This is a bug in the CheckFileSystemCaseSensitive task, which is distributed by TypeScript. Because it doesn't ship its dependency System.IO.FileSystem.dll, it only works if another task has loaded System.IO.FileSystem earlier in the build. On an incremental build, that's not happening (I suspect that the compiler task is what loads it when it works).

One possible workaround would be to define a property to disable incremental builds in your project. This will cause build times to increase (because the compiler will run all the time), but will force the compiler to run. If I'm right that the compiler is what's forcing the load, this should work around the problem.

You can try that by setting the property

<NonExistentFile>WorkaroundForTypescriptBuildTask</NonExistentFile>

in your project file.

This class of bug could be alleviated by dotnet/msbuild#1542.

@yuit
Copy link
Contributor

yuit commented May 10, 2017

@rainersigwald Thanks for providing workaround for the customers. Question - shouldn't "netstandard1.3" ship with "System.IO.FileSystem.dll" and " System.IO.FileSystem.Primitives.dll"? from our long ago discussion, Typescript should only need to ship these dependency for "net45"

@rainersigwald
Copy link
Member Author

@yuit This problem is arising in Visual Studio, which is using full-framework MSBuild and should use the net45 version of the TypeScript tasks.

@yuit
Copy link
Contributor

yuit commented May 10, 2017

@rainersigwald gotcha! The PR to fix this is in our internal repo

@yuit
Copy link
Contributor

yuit commented May 11, 2017

Update for others: the fix is in the PR. we will check it in tomorrow if nothing goes wrong and the our NuGet nightly should contain this fix

@yuit
Copy link
Contributor

yuit commented May 11, 2017

The fix should be in NuGet nightly today

@yuit yuit closed this as completed May 11, 2017
@yuit yuit added the Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet label May 11, 2017
@mhegazy mhegazy added Fixed A PR has been merged for this issue and removed Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet labels May 11, 2017
@kswarna
Copy link

kswarna commented Jun 29, 2017

I am still facing this issue with 'Microsoft.TypeScript.MSBuild 2.4.1'. The build/compiler works fine in my local machine. In my build server (which uses vs-2013 build agent), it fails with the following message

F:\Blds...\DEV\packages\Microsoft.TypeScript.MSBuild.2.4.1\tools\Microsoft.TypeScript.targets(174,5): error MSB4062: The "TypeScript.Tasks.CheckFileSystemCaseSensitive" task could not be loaded from the assembly F:\Blds...\DEV\packages\Microsoft.TypeScript.MSBuild.2.4.1\build\..\tools\net45\TypeScript.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

@rohatsu
Copy link

rohatsu commented Aug 24, 2017

The problem came back for me today (TS 2.4.1, VS 2017.3) with command-line MSBuild 15 failing. The resolution was to kill hanging MSBuild processes between my build steps (suspecting file in use although the error message said nothing about that).

@valeriob
Copy link

valeriob commented Sep 5, 2017

I confirm @rohatsu the problem is still present in vs 15.3.2 😢

@jlabaj
Copy link

jlabaj commented Feb 6, 2018

Issue is gone for me after updating to newest VS 15.5.6

@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

6 participants