How to: Deploy InfoPath Projects

The process of deploying an Microsoft Office InfoPath 2007 managed code form template is essentially the same as the process for deploying an InfoPath form template that uses script for form code. The primary difference is that the form code for a managed code form template is compiled as an assembly that runs under the common language runtime (CLR). This means that whenever you need to make changes to the form code in a managed code form template, you must open its project in Microsoft Visual Studio Tools for Applications (VSTA), Visual Studio 2005 with Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System, or Visual Studio 2008 with Visual Studio Tools for Office, make changes in the code editor, and then recompile your form template. Additionally, because the private assembly for a managed code form template is running under a hosted CLR application domain, the security settings for forms that require full trust differ somewhat from form templates that use script for form code.

Deploying Form Templates That Do Not Require Full Trust

If the form code for your form template does not use InfoPath object model members that require full trust, and the form template does not use features that require full trust, you can publish your form template directly from Visual Studio using the following procedure. For information about the InfoPath security model, see About the Security Model for Managed Code Form Templates.

Deploy a form template that does not require full trust

  1. Create and debug your form template in Microsoft Visual Studio Tools for Applications (VSTA) or Visual Studio.

  2. If you are working in InfoPath and VSTA, switch to InfoPath and click Publish on the File menu.

    If you are working in Visual Studio, click Publish on the Build menu.

    The form template is compiled and the Publishing Wizard is launched. Follow the steps in the Publishing Wizard to deploy your form to the location of your choice. For more information about using the Publishing Wizard, search InfoPath Help for "Publish a form template".

Deploying Form Templates That Require Full Trust

If the form code for your form template does use InfoPath object model members that require full trust, or the form template uses features that require full trust, you must do one of the following.

  • Digitally sign your form template (.xsn) file with a code signing certificate from a trusted publisher, which your users will be prompted to trust when they open the form. This will also make your form fully-trusted, and in turn grant the FullTrust permission set to your form code.

  • Use the As an installable form template option in the Publishing Wizard to create a script file (.js) or installation package (.msi) that will register your InfoPath form template as fully-trusted, which in turn grants the FullTrust permission set to your form code.

Compile, publish, and digitally sign a form template

  1. Create and debug your form template in Microsoft Visual Studio Tools for Applications (VSTA) or Visual Studio.

  2. If you are working in InfoPath and VSTA, switch to InfoPath and click Form Options on the Tools menu.

    If you are working in Visual Studio, click Form Options on the Tools menu.

  3. Click the Security and Trust category.

  4. Under Security Level, clear the Automatically determine security level check box, and then select Full Trust.

  5. Under Form Template Signature, select Sign this form template, click Select Certificate, and then specify the code signing certificate with which to sign the form template.

  6. Click OK twice to close the Form Options dialog box, and then save your changes.

  7. If you are working in InfoPath and VSTA, switch to InfoPath and click Publish on the File menu.

    If you are working in Visual Studio, click Publish on the Build menu.

  8. The form template is compiled and the Publishing Wizard is launched. Follow the steps in the Publishing Wizard to deploy your form template. For more information about using the Publishing Wizard to deploy a form template that requires full trust, search InfoPath Help for "Publish a form template with full trust".

Notes

  • To digitally sign a form, you must have an authenticated code signing certificate installed on your computer. To acquire such a certificate, you must contact a certification authority or your network administrator.

  • If you need to make changes to the form after publishing, you must repeat the procedure and re-sign the form template. This is because altering the form invalidates the digital signature. During the development of a form that requires full trust permissions you can use the procedure described in How to: Preview and Debug Managed Code Form Templates that Require Full Trust to register the form template on your local computer.

Compile, publish, and register a form template

  1. Create and debug your form template in Microsoft Visual Studio Tools for Applications (VSTA) or Visual Studio.

  2. If you are working in InfoPath and VSTA, switch to InfoPath and click Publish on the File menu.

    If you are working in Visual Studio, click Publish on the Build menu.

  3. The form template is compiled and the Publishing Wizard is launched.

  4. Click As an installable form template, and then click Next.

  5. Follow the steps in the Publishing Wizard to create a setup file. For more information about using the Publishing Wizard to deploy a form template that requires full trust as an installable form template, search InfoPath Help for "Publish a form template with full trust".

Note

If you need to make changes to the form after publishing, you must perform the following steps.

  1. Delete the script file (.js) or installation package (.msi) that was created the last time you ran the Publishing Wizard.

  2. Repeat the steps above to compile your form template and create a new setup file.

  3. Delete the previously installed form template, and then run the new setup file to re-install and register the updated form template.

Configuring .NET Framework Security Settings

For additional control over the permissions granted to managed code running in an InfoPath managed code form template, you can use the .NET Framework 2.0 Configuration utility to grant a particular permission set to your form code.

Important

Configuring .NET Framework security settings for an InfoPath managed code form template does not affect whether InfoPath object model members that require full trust are allowed to run. You must either digitally sign or register a form template as described earlier in this topic to enable calls to InfoPath object model members that require full trust. Configuring .NET Framework security settings apply only to calls to members of .NET Framework classes and managed components other than the InfoPath object model.

Compile, publish, and configure .NET security settings for a form template

  1. Create and debug your form template in Microsoft Visual Studio Tools for Applications (VSTA) or Visual Studio.

  2. If you are working in InfoPath and VSTA, switch to InfoPath and click Publish on the File menu.

    If you are working in Visual Studio, click Publish on the Build menu.

    The form template is compiled and the Publishing Wizard is launched. Follow the steps in the Publishing Wizard to deploy your form template. For more information about using the Publishing Wizard, search InfoPath Help for "Publish a form template".

  3. Perform the procedure described in the "Assigning FullTrust to Forms at a Specific URL or UNC" section of the How to: Configure Security Settings for Managed Code Form Templates

See Also

Tasks

How to: Configure Security Settings for Managed Code Form Templates

Concepts

About the Security Model for Managed Code Form Templates
How to: Preview and Debug Managed Code Form Templates that Require Full Trust