" CheckFileSystemCaseSensitive"任务意外失败,无法加载文件或程序集System.IO.FileSystem

时间:2017-05-04 20:07:02

标签: typescript msbuild visual-studio-2017 asp.net-core-1.1

到我的Visual Studio 2017,ASP.NET Core,MVC web项目我刚刚添加了Microsoft.TypeScript.MSBuild NuGet包v2.3.1,同时将我的ASP.NET核心程序集从1.0。*更新到1.1.1。现在,当我构建项目时突然出现以下异常:

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

双击异常消息将文件Microsoft.TypeScript.targets中的这些行中的一行:

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

它表示&#34; MSBuildThisFileFullPath未定义&#34;。

我已尝试添加对NETStandard.Library的引用,如此处所示:https://github.com/dotnet/corefx/issues/16206,但这并没有任何区别。

诊断MSBuild输出如下所示:

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.

感谢您的任何建议。

3 个答案:

答案 0 :(得分:2)

我在Vs2015中遇到了同样的错误,我从https://www.microsoft.com/en-us/download/confirmation.aspx?id=48593安装了类型脚本, 并且错误消失了,你可以尝试一下

答案 1 :(得分:1)

(旧问题,但这可能有助于其他人寻找这个问题的解决方案):

作为为VS项目配置TypeScript的替代方法,您可以尝试将Microsoft TypeScript Compiler nuget包添加到解决方案而不是Microsoft.TypeScript.MSBuild包。您可能需要在.csproj文件中配置<TypeScriptToolsVersion>(例如,您只需要次要和主要版本):

<TypeScriptToolsVersion>2.3</TypeScriptToolsVersion>

答案 2 :(得分:0)

对于Visual Studio 2017,直接从TypeScript SDK下载页面安装TypeScript 3.0 SDK。download