错误描述:

新建Visual Studio项目,所有的Reference引用都提示找不到,导致项目无法编译,而且报告以下错误:

Error 1 The "Microsoft.Build.Tasks.Windows.GetWinFXPath" task could not be loaded from the assembly PresentationBuildTasks, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35. Could not load file or assembly 'PresentationBuildTasks, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 系统找不到指定的文件。 Confirm that the <UsingTask> declaration is correct, and that the assembly and all its dependencies are available. WebApplication1

尝试解决方法:

1. 安装EnterpriseLibrary4.1后,安装程序会自动调用C:\EntLib41Src\Scripts\BuildLibrary.bat对源文件进行编译,不知什么原因,经检查C:\Windows\Microsoft.NET\Framework\v3.5目录下少了PresentationBuildTasks.dll文件,将拷贝过去;这时BuildLibrary.bat可以正常运行了,但报告100多个错误

2. 查看C:\EntLib41Src\Blocks\EnterpriseLibrary.msbuild文件,很明显可以看到MSTestExe和MSBuildTasks两项的配置有误,我安装的本来是Visual Studio 9.0,但此两项的值都是C:\Program Files\Microsoft Visual Studio 8.0.....,打开VS新建项目,还是不能编译

3. 计划打开Vista自带的事件查看器查看具体的错误原因,然后到谷歌搜索解决办法;但由于系统报错应用也无法打开了

折腾一晚上,没有进展。

第二天想到重新安装Visual Studio 2008,还是由于系统报错,导致VS08无法卸载。

4. 尝试重新安装.NET Framework3.5,之后测试VS项目编译功能,老样子

5. 继续安装.NET Framework3.5 SP1在测试,终于项目正常编译通过了,而且打开Vista的事件查看器,程序也正常运行了

由此可看出,一般的应用程序故障,通常是可以通过一步步分析而找到问题原因的,不需要动不动就重新安装整个开发环境,毕竟2、3G的东西够大;另一方面也可以锻练一下,自己动手解决问题