The InfoPath team is busy working on the next version of Office. While we’re offline, we’d like to take the opportunity to tackle some of the questions that we get asked frequently by InfoPath users.
Today I’ll talk about how to migrate your InfoPath projects from Visual Studio Tools for Office 2005 or Visual Studio Tools for Office 2008 (VSTO) into InfoPath 2010 with Visual Studio Tools for Applications (VSTA).
The decision to remove the ability to include InfoPath projects in professional developer solutions has been a controversial one, but is consistent with our overall message about SharePoint development – Create InfoPath forms with as little code as possible, and put the bulk of your code into middle tier services and workflows.
That said, we frequently hear from users who invested in VSTO projects and need to know how to move those projects forward with InfoPath 2010 and Visual Studio 2010. Here’s how.
This walkthrough will demonstrate how to migrate InfoPath code projects from Visual Studio Tools for Office (VSTO), and into Visual Studio Tools for Applications (VSTA).
VSTA is an IDE included with InfoPath 2007 and InfoPath 2010. The VSTA node is included in InfoPath 2010 setup. Launch Office setup, choose to customize the install, and set Visual Studio Tools for Applications to ‘Run from my computer’.
After installing VSTA, make a backup copy of your VSTO 2008 project that you will now proceed to migrate.
Let’s walk through the conversion process of a VSTO 2008 project named “Hardware Order Form”. This project includes:
1. Custom classes used to create database connections and run queries. See DBConnection.cs.
2. External XML that are linked to the InfoPath data source. See Items.xml.
3. InfoPath form code. See FormCode.cs
4. References to non-default NETFW assemblies. See System.Windows.Forms and System.Data.
Here is a screenshot of the Visual Studio project explorer to give an idea of the project structure:
To migrate this project to VSTA
1. Launch Windows Explorer, and navigate to the InfoPath “manifest.xsf” for your project. This file is included in the “InfoPath Form Template” directory of your Visual Studio 2008 project by default.
2. You’ll see a list of files that directly correspond to the “InfoPath Form Template” directory shown in the VS Solution Explorer screenshot above. For example:
3. Right click “manifest.xsf”, and choose Design from the context menu
4. InfoPath 2010 Designer will launch.
5. Click the Code Editor button in the InfoPath 2010 Developer tab, and the browse dialog will appear
6. Click the Browse button, and navigate to the csproj file in the backup copy of your project. Select the csproj file and click ‘Open’.
7. VSTA will launch, and your project will be successfully migrated into InfoPath 2010 and VSTA.
You can now work from within InfoPath 2010 and VSTA to code, build, and publish your solution.