通常,当在最新版本的Visual Studio中首次打开较旧的项目时,迁移管理器会启动并自动更正Visual Studio版本之间的任何不一致之处。但是,可能会出现其他问题。使用Visual Studio 2017 Community Edition的默认安装,尝试编译我正在使用的解决方案时返回以下错误:
仔细查看错误:The “Microsoft.Build.Tasks.Xaml.PartialClassGenerationTask” task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64\XamlBuildTask.dll. Could not load file or assembly ‘file:///C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\amd64\XamlBuildTask.dll’ or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.。似乎有一些XAML文件需要编译。老实说,我对这个特定项目不熟悉,所以我完全不知道这种依赖性。
若要解决此问题,请修改Visual Studio安装(使用Visual Studio安装程序),在“单个组件”选项卡中查找“ Windows Workflow Foundation”并选择它。
如果您传统上使用XAML或Windows Workflow Foundation,这似乎是一个非常明显的解决方案。但是,由于我也不习惯,所以花了一些时间才弄清楚。希望本文可以对其他人有所帮助。
转载链接:https://johnlouros.com/blog/how-to-fix-VS2017-missing-XAML-tools-build-error