2017-05-04 73 views
6

我的Visual Studio 2017,ASP.NET Core,MVC Web項目我只是添加了Microsoft.TypeScript.MSBuild NuGet包v2。 3.1,同時將我的ASP.NET Core程序集從1.0。*更新到1.1.1。現在,突然間,當我建立我的項目,我得到下面的異常:「CheckFileSystemCaseSensitive」任務意外失敗,無法加載文件或程序集'System.IO.FileSystem

上異常消息
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> 

地方說「MSBuildThisFileFullPath未定義」。

我試過添加引用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. 

感謝您的任何建議。

+0

我注意到,對於它的價值,這System.IO.FileSystem'的'最新版本是4.3.0,而不是4.0.1.0。 –

+1

MSBuild分發自己的門面程序集副本,允許運行鍼對netstandard構建的任務。我建議在https://github.com/Microsoft/msbuild/issues –

+1

完成https://github.com/Microsoft/msbuild/issues/2061 –

回答

0

(老問題,但是這可能會幫助其他人尋找一個解決這個問題):

作爲爲VS項目配置TypeScript的替代方法,您可以嘗試將Microsoft TypeScript Compiler nuget包添加到解決方案而不是Microsoft.TypeScript.MSBuild包中。您可能需要配置<TypeScriptToolsVersion>在.csproj的文件(你只需要在主要和次要版本如):

<TypeScriptToolsVersion>2.3</TypeScriptToolsVersion> 
相關問題