When you try to debug and test an InfoPath form project that
contains command line arguments, you receive the following error
message:
System.Collections.Generic.KeyNotFoundException
The given key was not present in the dictionary.
You receive the
error message if the InfoPath form project is built by using Microsoft Visual
Studio Tools for Office System (VSTO) or Microsoft Visual Studio Tools for
Applications (VSTA).
VSTO
To work around this issue in a VSTO project, follow these steps:
| 1. | In Visual Studio, click
ProjectName Properties on the
Project menu, and then click
Debug. |
| 2. | In the Start Action section, select
Start external program, and then locate the
Infopath.exe file. |
| 3. | In the Start Options section, type the
following in the Command line arguments box: /preview "Path\manifest.xsf" /sampledata "Path\template.xml" /viewname "View 1" /inputparameters
"Parameter" Note The view name may not be "View 1." You must verify the view name
in the project.
Parameter is the
placeholder for the parameter that you want to pass. |
| 4. | Press F5 to debug the project. |
VSTA
To work around this issue in a VSTA project, follow these steps:
| 1. | Create a new XML file that is based on the InfoPath form
template. The InfoPath form template is an .xsn file. |
| 2. | Save the XML file as Test.xml. |
| 3. | Click Start, click Run,
type InfoPath "Path\Test.xml"
/inputparameters "Parameter" in the
Open box, and then click OK. |