John Liu .NET

View Original

Copying SP2013 Workflow XAML files between VSNET projects

The Error

If you copy Workflow or Workflow Custom Activity objects between your SharePoint VSNET projects, sometimes you would see these errors:

Project file must include the .NET Framework assembly 'WindowsBase, PresentationCore' in the reference list.

Project file must include the .NET Framework assembly 'WindowsBase' in the reference list.

 

Why

This is actually a result of VSNET getting quite confused.  It thinks your workflow.xaml files are WPF XAML files.

image

 

The Build Action "Page" is special and tells VSNET that this is a WPF Page object.  Which then triggers the compiler requirement that the necessary libraries are not included in the project.

This can happen when you copy Workflow or Workflow Custom Activity files from one project to another, then use VSNET to "Include in Project"

image

 

The Fix

Is to tell VSNET the correct Build Action for an Workflow XAML file:

image

 

The correct Build Action for Workflow XAML objects is XamlAppDef

Go through your project and check every XAML file.

 

Result

image

 

Happy again.