Has anyone managed to package and successfully deploy a SharePoint 2013 Designer workflow as part of a Visual Studio Solution package?
I have created a SharePoint Designer 2013 workflow, performed a save workflow as template. Imported the workflow components (.vsdx, .xaml, association and customised Elements.xml) into visual studio which I am then adding to a Site Feature. This is working correctly (hint, set the xaml file to not be compiled). The site workflow is created and associated with any site where the feature is activated.
However the workflow will not start instead I receive an error: Microsoft.Workflow.Client.ScopeNotFoundException... The remote server returned an error: (404) Not Found
If I open then open the workflow in SharePoint Designer and publish it everything works correctly. This publish step is not required if I just add the exported workflow wsp to the solution gallery and activate.
So a couple of questions: 1. Has anyone got something similar working? I must be missing something but cannot for the life of me figure out what 2. Does anyone know how the SharePoint Designer Publish function works? Is this something which could be automated with CSOM or FeatureActivated code?