The "CheckFileSystemCaseSensitive" task failed unexpectedly, Could not load file or assembly 'System.IO.FileSystem
Asked Answered
C

3

7

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.

Thanks for any suggestions.

Cosby answered 4/5, 2017 at 20:7 Comment(7)
I note, for what it's worth, that the latest version of System.IO.FileSystem is 4.3.0, not 4.0.1.0.Cosby
MSBuild distributes own copies of facade assemblies that allow tasks built against netstandard to run. I suggest filing this as a bug in github.com/Microsoft/msbuild/issuesMader
Done: github.com/Microsoft/msbuild/issues/2061Cosby
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 closing and reopening either the project or the solution.Cosby
So far, this looks like a bug in either the typescript tasks or msbuild to me. but I think I can build a workaround (by replacing the failing target). are you targeting netcoreapp1.1 or a .net framework TFM?Mader
@MartinUllrich netcoreapp1.1Cosby
Here is the latest word on this: github.com/Microsoft/TypeScript/issues/…Cosby
C
2

I had the same error in Vs2015, i installed type script from https://www.microsoft.com/en-us/download/confirmation.aspx?id=48593 , and the error disappeared, you could give a try

Crawly answered 20/5, 2017 at 20:29 Comment(1)
Thanks for sharing this solution, worked for me with VS2019 I used TS 3.9 marketplace.visualstudio.com/…Gonococcus
F
1

(old question, but this may help anyone else looking for a solution to this issue):

As an alternative way of configuring TypeScript for your VS project, you can try adding the Microsoft TypeScript Compiler nuget package to the solution instead of the Microsoft.TypeScript.MSBuild package. You may need to configure the <TypeScriptToolsVersion> in the .csproj file (you only need the minor and major version e.g.):

<TypeScriptToolsVersion>2.3</TypeScriptToolsVersion>
Franzen answered 17/1, 2018 at 4:19 Comment(0)
I
0

For visual studio 2017 Install the TypeScript 3.0 SDK directly from the TypeScript SDK download page.download

Intolerable answered 21/8, 2020 at 14:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.