How to fix a "Could not load file or assembly XamlBuildTask.dll" build error

I have a VS project that uses Workflows Foundation that I originally created in VS 2013. Once I migrated to V2017 this project no longer compiled giving me the error message:

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 <UsingTask> 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.

The issue here is that the VS2017 doesn’t automatically install the Workflow Foundation tooling and supporting build tasks so this needs to be installed separately.

You can access the VS2017 installer from “Tools > Get Tools and Features” and scroll down to “Development Activities” and select Workflow Foundation.

You will then have to restart VS2017 for the changes to apply otherwise the build error will persist.

Tags: Visual Studio , Configuration , Workflow Foundation
Published: 10 January 2018

Return to top