SharePoint 2010 Deploy InfoPath in Visual Studio Solution with Code Behind

This post is based on my previous article in which i describe how to deploy an InfoPath form via Visual Studio Solution. Please read it first and then come back to this post cause we will use the example and add the code behind.

Ok, if you like to add code behind in your InfoPath form you normally have installed the VSTA Addin in your Office package. Afterwards you can choose which language for programming you would like to have.

After that you can add a loading event to your form.

It opens the Visual Studio Project.

Now you can deploy this project and you will find a .dll in your bin folder. Remember this. But first you publish your form again and put it into your solution again like in my previous post.

In your solution you add the .dll of the form code by using the add existing item menu to your module. Afterwords you have to do some settings. In the Solution Explorer mark your .dll file and delete the path at Deployment Location.

In the element file of your module the .dll should not be mentioned anymore like in this screen:

Please check your feature.xml file. It should contain the .dll but without the path to your module.

Now you can deploy your InfoPath form into Central Administration with having code behind.


The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

About Karsten Schneider 312 Articles
Consultant for Microsoft 365 Applications with a strong focus in Teams, SharePoint Online, OneDrive for Business as well as PowerPlatform with PowerApps, Flow and PowerBI. I provide Workshops for Governance & Security in Office 365 and Development of Solutions in the area of Collaboration and Teamwork based on Microsoft 365 and Azure Cloud Solutions. In his free time he tries to collect tipps and worthy experience in this blog.

Be the first to comment

Leave a Reply

Your email address will not be published.