Microsoft.Build.Utilities.FileTracker引发异常错误.发生不同的项目 [英] Microsoft.Build.Utilities.FileTracker threw an exception error. Happens with different projects
问题描述
最近在Win7 64bit中使用Visual Studio 2010 Ultimate C#,在编译任何项目时出现以下错误.解决方法是将<TrackFileAccess>false</TrackFileAccess>
添加到项目文件.如果我没记错的话,这会禁用增量构建,所以我想避免这种变通办法.
任何人都知道永久可靠的修复程序是什么?我确实重新安装了.NET Framework 4和VS2010.我没有beta或更低版本的4.0 Framework文件夹.
Error 1 The "GenerateResource" task failed unexpectedly.
System.TypeInitializationException: The type initializer for 'Microsoft.Build.Utilities.FileTracker' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Build.Utilities.FileTracker..cctor()
--- End of inner exception stack trace ---
at Microsoft.Build.Utilities.FileTracker.ForceOutOfProcTracking(ExecutableType toolType, String dllName, String cancelEventName)
at Microsoft.Build.Tasks.GenerateResource.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext
我通过反映Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Microsoft.Build.Utilities.v4.0.dll <为我的环境找到了解决方案/p>
我的TEMP/TMP环境变量指向ram驱动器的根文件夹(T:\),没有任何其他目录嵌套! 在Microsoft.Build.Utilities.FileTracker的静态控件中,行s_tempPath = Path.GetDirectoryName(Path.GetTempPath()); 导致null,这将导致您提到的异常.
现在,我的TEMP/TMP环境变量指向T:\ TEMP,并且一切正常.
Lately with Visual Studio 2010 Ultimate, C#, in Win7 64bit, I get the error below when I compile any project. The workaround is to add <TrackFileAccess>false</TrackFileAccess>
to the project file. If I am not mistaken this would disable incremental builds so I want to stay away from this workaround.
Anyone knows what the permanent reliable fix is? I did reinstall .NET Framework 4 and VS 2010. I don't have beta or prior versions of 4.0 framework folders.
Error 1 The "GenerateResource" task failed unexpectedly.
System.TypeInitializationException: The type initializer for 'Microsoft.Build.Utilities.FileTracker' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Build.Utilities.FileTracker..cctor()
--- End of inner exception stack trace ---
at Microsoft.Build.Utilities.FileTracker.ForceOutOfProcTracking(ExecutableType toolType, String dllName, String cancelEventName)
at Microsoft.Build.Tasks.GenerateResource.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext
I found the solution for my environment by reflecting Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Build.Utilities.v4.0.dll
My TEMP/TMP environment variable was pointing to a ram drive root folder (T:\) without any further directory nesting! The line s_tempPath = Path.GetDirectoryName(Path.GetTempPath()); in the static ctor of Microsoft.Build.Utilities.FileTracker resulted in null, which caused the exception as mentioned by you.
Now my TEMP/TMP environment variable is pointing to T:\TEMP and everything is working fine.
这篇关于Microsoft.Build.Utilities.FileTracker引发异常错误.发生不同的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!