I am new to SharePoint and .Net development, sorry if answer for my question is obvious.

I've created SharePoint solution, which uses InfoPath form. When I deploy it from Visual Studio, all work fine, but when I try to deploy WSP package from web interface it fails with error:

[ArgumentException: The path is not of a legal form.]
System.IO.Path.NormalizePathFast(String path, Boolean fullCheck) +3806
System.IO.DirectoryInfo..ctor(String path) +245       
Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver.EnumerateFormTemplates(SPFeatureDefinition featureDef) +156
Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver.FeatureInstalled(SPFeatureReceiverProperties properties) +789
Microsoft.SharePoint.Administration.SPFeatureDefinition.DoInstallationCallout(SPSite site, String solutionHash, Boolean fInstall) +27309665
Microsoft.SharePoint.Administration.SPFeatureDefinition.Install(SPSite site, String solutionHash) +444
Microsoft.SharePoint.Administration.SPFeatureDefinitionCollection.AddCore(SPFeatureDefinition featdef, SPSite site, String solutionHash, Boolean fForce, Boolean fDoValidation) +26381365
Microsoft.SharePoint.Administration.SPFeatureDefinitionCollection.AddInternal(String relativePathToFeatureManifest, Guid solutionId, String solutionHash, SPSite site, Boolean force, Boolean fDoValidation, SPFeatureDefinitionContext featureDefinitionContext) +174
Microsoft.SharePoint.Administration.SPSolutionPackage.AddFeatureDefinitions(SPFeatureDefinitionCollection featColl, SPFeatureDefinitionContext context, Boolean force, Boolean activateFeatures, SPSite site, SPWeb web) +290
Microsoft.SharePoint.Administration.SPUserCodeSolutionPackage.EnableSiteCollectionSolution(SPSite site, Int32 solutionGalleryItemId, Boolean force) +23867323
Microsoft.SharePoint.<>c__DisplayClass1.<AddOrUpgrade>b__0() +4075
Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) +27948246
Microsoft.SharePoint.SPUserSolutionCollection.AddOrUpgrade(SPListItem item, SPUserSolution existingSolution) +449
Microsoft.SharePoint.SPUserSolutionCollection.Add(Int32 solutionGalleryItemId) +574
Microsoft.SharePoint.WebControls.SolutionItemButton.ActivateItem() +398
Microsoft.SharePoint.WebControls.SPLinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +72
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981

My module Elements.xml:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="Forms">
    <File Path="Forms\CustomTaskForm1.xsn" Url="Forms/CustomTaskForm1.xsn" />
    <File Path="Forms\CustomTaskForm0.xsn" Url="Forms/CustomTaskForm0.xsn" />
    <File Path="Forms\CustomTaskForm7.xsn" Url="Forms/CustomTaskForm7.xsn" />
    <File Path="Forms\ApproveTaskForm.xsn" Url="Forms/ApproveTaskForm.xsn" />

There is an answer to the problem here, which tells that the error occurs then Path attrubute is incorrect, but I can't understand what directory is current and how I have to change the Path attribute. Could you help me, please?

Thank you in advance.

UPDATE1: Thanks to Kai answer, solution was found. There was an error in my Feature.Template.xml:

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/">
 <ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"   ReceiverClass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver">
   <Property Key="GloballyAvailable" Value="true" />
   <Property Key="RegisterForms" Value="Forms\*.xsn"/>

When I removed ReceiverAssembly element, all deploys succesfully.

UPDATE 2: But now I have got next question. When I deploy my solution, it deploys without errors, creates all lists , but I can't see my workflows. When I deploy it using VS2010 all works fine (workfows shown and associated with lists).

UPDATE 3: Actually, it doesn't work... when I remove ReceiverAssembly element it only deploys without error, but when I choose task (and InfoPath form have to start), it fails... When I change my ReceiverAssembly element how Kai shows, it deploys from VS, but not from WSP again...

UPDATE 4: Hurray! Now it works! Thanks to all!

  • For your second question, I would recommend asking a new question with the details. You can always link back to this one if you need to.
    – Kit Menke
    Mar 12, 2012 at 14:24
  • @Puhan, if you want to register your form templates in form services, you should update your feature tag with <Feature xmlns="http://schemas.microsoft.com/sharepoint/" Title="UpdateItemTitleWF" Id="7e843b56-cec3-4eeb-8c89-8a746dbf723a" ReceiverAssembly="Microsoft.Office.Workflow.Feature, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ReceiverClass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver" Scope="Site"> Mar 12, 2012 at 15:54
  • When I add it, deployment fails, but without it, I can't use InfoPath forms when I deployed it by VS. Did I understood you right, that without this tag, I can't use InfoPath forms in my solution?
    – MikhailSP
    Mar 13, 2012 at 8:42

2 Answers 2


As per msdn - DirectoryInfo -

ArgumentException - path contains invalid characters such as ", <,> >, or |

Path in your situation is featureDef.RootDirectory (by stack trace I can see that you are using WorkflowFeatureReceiver, so check out method EnumerateFormTemplates using Reflector). Check if path to your feature contain not legal characters.

  • Big thanks! Now it deploys without errors, but I have new question shown above, could you help me, please?
    – MikhailSP
    Mar 12, 2012 at 13:58

I've found the answer. Now it works. It seems like the root of the problem is next: I've tryed to add WSP Farm solution to sandbox solution gallery. I have to use another way for deploying, for example PowerShell.

PS: Thanks to Balamurugan-S KAUST answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.