This documentation is archived and is not being maintained.

About the Macros for the Microsoft Office InfoPath 2003 Toolkit for Visual Studio .NET

Office 2003

Two Microsoft® Visual Studio® .NET 2003 macros are provided in the Microsoft® Office InfoPath™ 2003 SDK to facilitate the development of managed code form templates within the Visual Studio .NET environment when using the Microsoft Office InfoPath 2003 Toolkit for Visual Studio .NET. You can download the Microsoft Office InfoPath 2003 Toolkit for Visual Studio .NET from the Office Developer Center Web site.

  • The IPFullTrust macro makes your InfoPath form template fully trusted for debugging and previewing from Visual Studio .NET.
  • The SignCode macro code signs your InfoPath form project with a code signing certificate.

These topics provide instructions for the use of these macros with your own InfoPath managed code form templates, and describe the dependencies the macros have. This topics also include code walkthroughs of the macros so that developers will feel comfortable modifying the macros for their own environments and needs.

Microsoft Office InfoPath 2003 forms can be deployed with varying levels of security. When you create or edit a form template in the InfoPath designer, InfoPath modifies the publishUrl attribute in the form definition (.xsf) file. This attribute contains the URL of the location of the form template. Without any specific changes, managed code from URL-based forms is granted the LocalIntranet permission set. If managed code attempts to access a resource that requires permissions outside the granted set of permissions, a security exception will be thrown.

Fully trusted forms have a higher set of permissions than sandboxed forms. For example, they can contain managed code that accesses system resources such as the local file system. They can use software components or Microsoft® ActiveX® controls that are not marked as safe for scripting. They can make calls to COM components through a Primary Interop Assembly, and they can call methods in the InfoPath object model that are restricted to use by fully trusted forms.

In order to debug or preview a form that contains managed code that accesses system resources, a form must be set to full trust. Doing so on a development computer requires modifying the manifest.xsf and template.xml files and then registering the form on the computer. The process is fully documented in Understanding Fully Trusted Forms.

When an InfoPath form solution is opened in Visual Studio, the trust level in the form template is reset. Because manually setting a form to full trust is a time-consuming process, a macro has been created to automate the process. When run, the IPFullTrust macro makes the necessary modifications to manifest.xsf and template.xml and then registers the solution. This allows the developer to step through code in the Visual Studio .NET debugger without encountering security exceptions. With the form solution registered, a developer can make additional changes to code and still maintain full trust. The macro does not need to be re-run.

Form templates can be digitally signed with a code signing certificate to provide proof of a form's origin. A Visual Studio .NET InfoPath solution automatically generates a form template (.xsn) file that can be used for testing and debugging of signed solutions.

Signing code is typically done with the Signcode.exe utility included in the .NET Framework SDK. However, the .xsn file is regenerated every time an InfoPath solution is built. Because running this utility every time a form template project is changed during the development process would be cumbersome, the SignCode macro has been created to automate the process. This macro automatically signs the form template (.xsn) file in the Visual Studio build folder (/bin/debug or /bin/release) on every successful build.

To learn how to work with the IPFullTrust and SignCode macros, see the following topics:

Installing and Using the Macros

Macro Code Walkthroughs

Troubleshooting the Macros