in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Sander's Blog

October 2007 - Posts

  • Copying Infopath VSTO projects

    Copying VSTO Infopath project can save you a lot of time, but it can also bring you a lot of problems.

    Follow these steps to avoid problems:

    • 1. Copy the project directory, change the name and add the new project to your solution
    • 2. Rename the project (from VS)
    • 3. Open the manifest.xsf in the XML Editor (Open with..)
    • 4. Update the name attribute in the xsf:xDocumentClass element
    • 5. Update the projectpath attribute in the xsf2:managedCode element
    • 6. Update the initialDocumentName attribute in the xsf:initialXmlDocument element
    • 7. Open template.xml and update the name attribute in the mso-infoPathSolution element
    • 8. Update the AssemblyProduct in AssemblyInfo.cs

      [Optional]
    • 9. [optional from here] Rename the assemblies and namespaces
    • 10. Update the Assembly name and the Default namespace in de project properties
    • 11. Update the Namespace in your code (note the partial classes!)
    • 12. Delete old dll's and debug files from your project
    • 13. Open manifest.xsf in de XML Editor (Open with..)
    • 14. Delete the xsf:file elements to the old dll en debug files

    • 15. Rebuild your project
  • Infopath VSTO post-build steps

    Also tired of running the publish form wizard every time? Especially when you are developing a larger number of forms this can be a frustrating and time consuming task.

    This is a description of the post-build steps for automatically building and deploying the forms:

    1. Copy the files to a temp dir (Visual Studio creates a lock on the files)
    xcopy "$(ProjectDir)Infopath Form Template\*" "c:\temp\$(ProjectName)\"

    2. Delete Myschema.xsx - this is not part of the form template
    del /Q "c:\temp\$(ProjectName)\*.xsx"

    3. Put the folder in a cab file (download the CAB tool here)
    cabtool "c:\temp\$(ProjectName)"

    4. Rename the CAB to XSN
    ren "c:\temp\$(ProjectName).cab" "$(ProjectName).xsn"

    5. Deactivate the previous edition of the form
    stsadm -o deactivateformtemplate -url http://yoursite -filename "c:\temp\$(ProjectName).xsn"

    6. Remove the previous version of the form
    stsadm -o removeformtemplate -filename "c:\temp\$(ProjectName).xsn"

    7. Kick the job service (saves you the wait)
    stsadm -o execadmsvcjobs

    8. Upload the new template
    stsadm -o uploadformtemplate -filename "c:\temp\$(ProjectName).xsn"

    9. Kick the job service (again)
    stsadm -o execadmsvcjobs

    10. Activate the new form template
    stsadm -o activateformtemplate -url http://yoursite -filename "c:\temp\$(ProjectName).xsn"

    11. Clean up the mesh 
    del /Q "c:\temp\$(ProjectName)"
    del /Q "c:\temp\$(ProjectName).xsn"
    rmdir "c:\temp\$(ProjectName)" /q /s

    This will result in:
    xcopy "$(ProjectDir)Infopath Form Template\*" "c:\temp\$(ProjectName)\"
    del /Q "c:\temp\$(ProjectName)\*.xsx"
    cabtool c:\temp\$(ProjectName)
    ren "c:\temp\$(ProjectName).cab" "$(ProjectName).xsn"
    stsadm -o deactivateformtemplate -url http://yoursite -filename "c:\temp\$(ProjectName).xsn"
    stsadm -o deactivateformtemplate -url http://theirsite -filename "c:\temp\$(ProjectName).xsn"
    stsadm -o removeformtemplate -filename "c:\temp\$(ProjectName).xsn"
    stsadm -o execadmsvcjobs
    stsadm -o uploadformtemplate -filename "c:\temp\$(ProjectName).xsn"
    stsadm -o execadmsvcjobs
    stsadm -o activateformtemplate -url http://yoursite -filename "c:\temp\$(ProjectName).xsn"
    stsadm -o activateformtemplate -url http://theirsite -filename "c:\temp\$(ProjectName).xsn"
    del /Q "c:\temp\$(ProjectName)"
    del /Q "c:\temp\$(ProjectName).xsn"
    rmdir "c:\temp\$(ProjectName)" /q /s

    Additional tip:
    Once you switch from a Debug build to the Release build you should:
    - manually remove the pdb files from your manifest file
    - remove the pdb files from your project directory

  • Avoiding performance issues in Infopath Forms Servers

    Recently I've been doing a lot with IFS. It seems like the ideal solution to create and present forms, far more capable than regular SharePoint list forms and far less complicated than coding forms in  Visual Studio.

    But there are some caveats to this beauty, which begin to appear just after you've just got yourself and your client in a good mood by finding all of your requirements covered by Infopath: Performance.

    We've ran into a number of problems after publishing some more 'complex' forms, these are some examples:
    - A repeating section does not persist more than 9 items
    - IE  crashes while filling out the form, totaly random
    - Rendering the form takes >60 seconds, taking 99% CPU and +600mb RAM
    - Uploading the form results in a error (both Central Admin and STSADM)
    - The design checker times-out, InfoPath cannot open the form

    Most of these problems occur at the browser. It's interesting to note that the server does not have any trouble serving the forms. Rendering the form in the browser is done fully dynamically. With complex and large forms this can lead to bad performance and functional issues. Uploading complex forms can take up to 30 minutes (depending on the time-outs you've defined in SharePoint).

    This is a list of best practices to keep you in control of performance. There's definitely not one golden solution, you should look for a balance throughout your form. 

     1. Use IE7 instead of IE6
    IE7 used a new scripting engine, which is far more efficient with resources. While rendering forms this could save you hundreds of mb's and up to 50% CPU. In practice forms will render up to 10x faster in IE7.

    2. Deploy the hotfix for conditional formatting issues (must have!)
    Conditional visibility logic has some known performance problems.  A hotfix is available http://support.microsoft.com/kb/937206, which is manifested in a modified 250K initial download (de core.js) when accessing Forms Services the first time.  The performance issue is related to the IE Script Engine and occurs at the browser level, not server-side.

    I've tested a form before and after installing the hotfix:

      IE6.0* IE7.0*
      Without hotfix With hotfix Without hotfix With hotfix

    Rendering

    65 sec 15 sec 14 sec 13 sec
    CPU Load 99% 99% 50% 50%
    RAM 60mb 30mb 68mb 40mb

    * IE6 en IE7 installed on different hardware, do not compare the results between browsers


    3. Avoid nested elements
    Nesting sections, tables, optional sections and especially repeating sections/tables could lead to a extreme rendering time at the client. 

     4. Use multiple views
    Try to spread controls over multiple views. This especially counts for complex controls like:
    - Rich text editors
    - Repeating sections/tables
    - Drop down boxes

     5. Minimize the numer of Rich text editors
    Try to use regular textfields if possible

     6. Avoid excessive use of validation/rules/conditional formatting
    Try to prevent unnecessary roundtripping between the form browser and the server.  There are several round trip switches available on controls.   See the Browser Forms Tab on a given control to expose finer-grained options over the behavior.  Note what the warning messages you receive say about the form's potential round trip behavior when admin deploying the form.  It will tell you when multiple server roundtrips will be likely to occur when using your form.

     7. Run Forms Services on a sererate server
    Consider breaking out the server role of Forms Services to another machine on the MOSS farm.  Services such as indexing and query serving, or high file I/O operations can really impact the ability of Forms Services to get a time slice and perform properly. 

     8. Set the optimal Session State
    Forms Services supports 2 kinds of session state:
    - Session State (data is saved in SQL through the SSP)
    - Form View (data is saved in the form itself)

    The following articles describe which is best for your situation:
    http://technet2.microsoft.com/Office/en-us/library/3c4e8fb1-c3ce-4d27-8c65-6c4ab140f7051033.mspx?mfr=true
    http://technet2.microsoft.com/Office/en-us/library/3728d1fa-c1db-4445-8d00-e26f9015dd951033.mspx?mfr=true 

     

    Be sure to check Tim Pashmans blogpost on IFS performance:
    http://blogs.msdn.com/timpash/archive/2007/08/02/tips-and-tricks-for-tuning-forms-services-performance.aspx


Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts