How to share code among Infopath forms? - InfoPath Dev
in

InfoPath Dev

How to share code among Infopath forms?

Last post 02-11-2011 08:54 AM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 02-10-2011 07:41 AM

    • renato
    • Not Ranked
      Male
    • Joined on 12-02-2010
    • Romano
    • Posts 16

    How to share code among Infopath forms?

    I have 6 form templates deployed on a Sharepoint form library as site content types (though I guess this information is irrelevant to my question...) All the 6 templates have a big part of code behing which could be re-used, while at the moment I have it duplicated in all of them. Ideally I would build a new project for a dll where to place the code to be reused, then add references to that dll from within the form's code, but I'm not really sure how to proceed. I'm using IP 2010 in 2003 compatible mode, and VSTA for coding. I don't seem to be able to build a library with VSTA, there isn't a "New Project" menu option. I would also be unsure about what should I do with the generated dll; should I install it in the GAC? Just leave it in the project folder and reference it from there? I maybe need Visual Studio?

     Any help is really appreciated,

    Renato

    Filed under: , , ,
  • 02-10-2011 08:45 AM In reply to

    Re: How to share code among Infopath forms?

    I think you could create the new project with your common code, and then add a reference to the project (not the compiled dll). When I open VSTA directly (not from InfoPath), I do see the option for New Project on the menu, but if I click it, I get a message about no templates installed.

    However, there are free editions of Visual Studio available (Visual Studio Express editions) -- you could always check those out.

    Hilary Stoupa

  • 02-11-2011 02:26 AM In reply to

    • renato
    • Not Ranked
      Male
    • Joined on 12-02-2010
    • Romano
    • Posts 16

    Re: How to share code among Infopath forms?

    Yap, same thing happening to me, I do have the "New Project" menu item, but no templates installed. I also tried following the route indicated in the system application event log to run vsta /installvstemplates, but that was unsuccessful as well. I'm going to use VS express, that should be enough. So thanks a lot for your suggestion; just an additional question: why shouldn't I reference the compiled dll? Wouldn't that just bring that dll within the xsn cab of the form?

  • 02-11-2011 08:54 AM In reply to

    Re: How to share code among Infopath forms?

    You are right -- you can just add the compiled dll. I guess I just usually find I always have one more thing I need to add to my common code, so it is easier to add the project as reference and then I can easily update it. You may be more organized than I am.... :- }

    Hilary Stoupa

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.