Udostępnij za pośrednictwem


Working with VSTO 2008 Projects in InfoPath 2010

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).

 

First, ensure that VSTA is installed

 

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’.

 

 

Next, migrate your project

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.

Comments

  • Anonymous
    May 18, 2011
    Is there aany VSTO vertion for IP 2010? or VSTO is retired??

  • Anonymous
    June 02, 2011
    Your decision to remove the ability to include InfoPath projects in professional developer solutions has left our organization with a total mess.  I'm happy that it's consistent with your overall message.  You should feel proud.

  • Anonymous
    June 07, 2011
    @c.b.fernald - I have to agree with you on this one. We are in the process of deciding whether or not this is a viable solution going forward. I am personally looking at how to migrate our existing forms. The tooling message of using VSTA (aka VS 2008 and framework 2.0) when VS 2010 and the 4.0 framwork is the direction of everything else really disappoints me. I wish this team would do some out of band CTP releases. Not only have the tooling and libraries changed, but we also have to deal with the absence of the regform.exe tool for signing. We started using the InfoPath.ExternalApplication.RegsiterSolution for our old templates, but it doesn't seem to be working with the converted templates, as we are getting an error message that we can't install forms that have publish locations. It is looking more and more like we will just shell out a few bucks for a certificate and be done with it.

  • Anonymous
    July 22, 2011
    VSTA that shipped with InfoPath 2010 is .NET 2.0, if you wanted stay consistent with your overall message you would have upgraded VSTA to .NET 4.0. InfoPath is great application, stop assuming all industries use InfoPath with SharePoint. What happen to XDown Tool? You need SharePoint services to use web enable InfoPath! Really! That is the only solution you guys come up with!  Even if I just want to view the form on the web with some filters. "Create InfoPath forms with as little code as possible, and put the bulk of your code into middle tier services and workflows” that is nonsense.  InfoPath project within Visual Studio was the reason most developers started to use InfoPath, now they are obligated to use .net 2.0. Thank you InfoPath Team!!!

  • Anonymous
    September 02, 2011
    Ater adding the reference -->System.Windows.Forms everything works fine. However when I close the project and reopens it again the System.Windows.Forms reference disapears. Is there a way to make it stay on the code for good? Thanks in advance

  • Anonymous
    October 06, 2011
    OK, How come VSTA in Infopath 2010 doesn't recognize an access 2010 database? I can make the data connections in Infopath but not in the code editor as it doesn't recognize the accdb databse. It only can see the mdb files and format.

  • Anonymous
    July 24, 2012
    hi is Infopath dead! there has been no news as to whether a new version is being released. no posts over a year !!!!

  • Anonymous
    December 17, 2012
    Is this blog dead? No more Tips on on 2013?