2

Resolved

Exception when trying to add Custom Form to ContentType

description

We get the following exception when we try to execute the ContentTypeCustomForm.xml recipe:

Microsoft.Practices.RecipeFramework.ActionExecutionException: An exception occurred during the binding of reference or execution of recipe ContentTypeCustomForm. Error was: Action AddCustomForms failed to execute:
Exception of type 'Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TemplateException' was thrown..
You can remove the reference to this recipe through the Guidance Package Manager. ---> Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TemplateException: Exception of type 'Microsoft.Practices.RecipeFramework.VisualStudio.Library.Templates.TemplateException' was thrown.
at SPALM.SPSF.Library.Actions.BaseItemAction.Render(String templateCode, String templateFile)
at SPALM.SPSF.Library.Actions.BaseItemAction.GenerateContent(String templateFilename, String targetFilename, NameValueCollection overrideArguments)
at SPALM.SPSF.Library.Actions.BaseItemAction.GenerateContent(String templateFilename, String targetFilename)
at SPALM.SPSF.Library.Actions.BaseTemplateAction.Execute()
at SPALM.SPSF.Library.Actions.AddTemplateToItemAction.Execute()
at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionExecutionService.Execute(String actionName, Dictionary`2 inputValues)
at Microsoft.Practices.RecipeFramework.Recipe.Microsoft.Practices.RecipeFramework.Services.IActionExecutionService.Execute(String actionName)
at SPALM.SPSF.Library.Coordinators.ConditionalCoordinator.Run(Dictionary`2 declaredActions, XmlElement coordinationData)
at Microsoft.Practices.RecipeFramework.Recipe.ExecuteActions(IDictionaryService readOnlyArguments, IDictionaryService arguments, ITypeResolutionService resolution)
--- End of inner exception stack trace ---
at Microsoft.Practices.RecipeFramework.Recipe.UndoExecutedActionsAndRethrow(Exception ex)
at Microsoft.Practices.RecipeFramework.Recipe.ExecuteActions(IDictionaryService readOnlyArguments, IDictionaryService arguments, ITypeResolutionService resolution)
at Microsoft.Practices.RecipeFramework.Recipe.Execute(Boolean allowSuspend)
at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe, IAssetReference reference, IDictionary arguments)
at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(IAssetReference reference)
at Microsoft.Practices.RecipeFramework.RecipeReference.OnExecute()
at Microsoft.Practices.RecipeFramework.AssetReference.Execute()
at Microsoft.Practices.RecipeFramework.VisualStudio.RecipeMenuCommand.OnExec()
at Microsoft.Practices.RecipeFramework.VisualStudio.AssetMenuCommand.Invoke()

What's wrong? How to debug?
Attached our dump of installed Visual Studio add-ins.

file attachments

comments

matein78 wrote May 9, 2013 at 9:46 PM

Seems like a bug in the recipe "Add CustomForums to Content Type", which might have been introduces with the upgrade to VS2012.I will fix it in the next release.

As a workaround, you can create the custom forms along with the content type in the content type recipe instead.

bclevering wrote May 10, 2013 at 7:25 AM

@matein78; your assumption is correct... Only when you create a recipe afterwards the creation of the contenttype this error occurs.

matein78 wrote May 13, 2013 at 1:58 PM

I found the issue and will fix it in the next release.

As a quick workaround edit the C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Recipes\Artefacts\ListAndDoc\ContentTypeCustomForm.xml file

find and add following code afterwards (line 57)



The recipe will work then (after you closed and opened the solution again) but will only add the custom forms for standard list content types (in case you want one for a document content type 0x0101 would be required in the value field)

The final fix will then provide the actual parent content type of the selected content type.

matein78 wrote May 13, 2013 at 1:59 PM

Sorry, the formatting did go wrong. But you get the picture :)

matein78 wrote May 28, 2013 at 2:55 PM

Fixed in SharePoint Software Factory 4.1.3