Showing posts with label deployment. Show all posts
Showing posts with label deployment. Show all posts

2015-12-03

Running a Project with Workflow in Provider-Hosted Add-In

While trying to run (F5 in Visual Studio) add-in project of provider-hosted add-in containing workflow I got this error in output window:

Microsoft.SharePoint.WorkflowServices
System.FormatException: RestrictAssociationToId   
 at Microsoft.SharePoint.WorkflowServices.DGWorkflowDeploymentProvider.PublishOrUpdateDefinitions(WorkflowServicesManager proxy, WorkflowDeploymentService deploymentService, Dictionary`2 oldDefinitionIdMap, Dictionary`2 newDefinitionIdMap, Dictionary`2 listIdDictionary)   
 at Microsoft.SharePoint.WorkflowServices.DGWorkflowDeploymentProvider.DeployOrUpgrade(WorkflowScopeIdentifier scopeId, SPWorkflowPart oldParts, SPWorkflowPart newParts, Dictionary`2 listIdDictionary)   
 at Microsoft.SharePoint.WorkflowServices.DGWorkflowDeploymentProvider.Deploy(WorkflowScopeIdentifier scopeId, SPWorkflowPart parts, Dictionary`2 listIdDictionary) StackTrace:
 at Microsoft.Office.Server.Native.dll: (sig=678c0f87-966f-4d99-9c94-b49e788d2672|2|microsoft.office.server.native.pdb, offset=131CE)
 at Microsoft.Office.Server.Native.dll: (offset=21BE5)


Turns out I didn't include target list and history list in the app feature. This caused aforementioned error while trying to deploy workflow during "Activate features" stage. As soon as I included the lists in the feature everything went ok.

2015-08-19

Failed to load receiver assembly, System.IO.FileNotFoundException: Could not load file or assembly or one of its dependencies on Feature Receiver in SharePoint 2013

After breaking the deploy process by pressing CTRL+BREAK during Visual Studio 2012 deploy of SharePoint 2013 WSP I wasn't able to deploy my package any more. Deploy was failing with the message:

Failed to load receiver assembly...

After fiddling with Process Monitor and Fusion Log for a while I couldn't pinpoint why assembly couldn't be loaded. Assembly exists at appropriate location in GAC but my concern is that Visual Studio tries to access it few seconds before it is actually copied to GAC during deploy process. Aforementioned exception happens during feature activation phase of deploy process.

My solution to the problem was to change assembly version from 1.0.0.0 to 1.0.0.1 and build the SharePoint project. After that I I deleted feature receiver and added feature receiver again so that feature manifest XML file gets updated with correct version of feature receiver assembly.

2014-10-29

Visual Studio 2013 Cannot Deploy Content Type Updates

After spending 10+ hours trying to figure out why content types included in my wsp cannot be deployed using Visual Studio 2013 deploy without recreating SP site I must say I am disappointed with my findings. Content types cannot be removed from SP site by using Visual Studio 2013 Retract command. My colleague can successfully deploy (and retract) content types using Visual Studio 2012, so I decided to look inside what is really happening under the hood.

Apparently, both Visual Studio versions, 2012 and 2013, are using Microsoft.VisualStudio.SharePoint.Commands.Implementation.V5.dll to deploy and retract SharePoint solutions to SharePoint sites. But the big difference between the two is that VS 2012 implements Microsoft.VisualStudio.SharePoint.Commands.DeploymentManager.DeactivateFeatures in a way so that it calls SPFeatureCollection.Remove method with force argument set to true which causes a call to stored procedure proc_DeactivateContentTypeInScope with SQL parameter @IsDeactivatingFeature set to 2. When this parameter is set to 2 then stored procedure skips a call to another stored procedure named proc_IsContentTypeInUse. This basically forces the deletion of content type.

VS 2013 implements Microsoft.VisualStudio.SharePoint.Commands.DeploymentManager.DeactivateFeatures with a call to Microsoft.VisualStudio.SharePoint.Commands.DeploymentManager.DeactivateFeature method which makes a call to SPFeatureCollection.Remove with force argument set to false which causes a call to stored procedure proc_DeactivateContentTypeInScope with SQL parameter @IsDeactivatingFeature set to 1. This prevents content type from being deleted.

I am using version of VS 2013 which is Visual Studio Premium 2013 Version 12.0.30723.00 Update 3.

I hope MS provides a fix to this issue soon. Until then I am reverting to VS 2012.

2014-08-26

Error occurred in deployment step ‘Activate Features': System.TimeoutException: The HTTP request has timed out after 20000 milliseconds.

I am running SP 2013 dev environment and I recently ran into a problem described in the post title. I tried to deploy a solution with feature activation which included SP 2013 Workflow SPIs. I tried to solve the issue by applying a solution described here but it wasn't helpful in my situation. I already had registry settings set up to extend timeout period for SharePoint deployment.

Visual studio output window might look like this:
  Activating feature 'Feature1' ...
Error occurred in deployment step 'Activate Features': System.TimeoutException: The HTTP request has timed out after 20000 milliseconds. ---> System.Net.WebException: The request was aborted: The request was canceled.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at Microsoft.Workflow.Client.HttpGetResponseAsyncResult`1.OnGotResponse(IAsyncResult result)
   --- End of inner exception stack trace ---
   at Microsoft.Workflow.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at Microsoft.Workflow.Client.Ht


I noticed that I had Fiddler2 running in the background while trying to deploy my solution. I exited Fiddler2 application and tried to deploy again. This time deploy was successful. It very well might be a cause of error. Just to be sure I tried to reproduce the same behavior again by starting Fiddler2 again and trying to deploy the wsp using Visual Studio 2012. This time VS couldn't delete workflows and workflow associations from the site but it was able to deploy successfully. I turned off Fiddler2 again and tried to deploy, and it went smooth, without any errors. I might be wrong but it seems to me that Fiddler's proxy is interfering with deployment of workflows.

I know there are many reasons causing this error but this solution helped me. Hopefully it helps someone else.