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.

Karsten Pohnke About Karsten Pohnke
He is Consultant for SharePoint Solutions for collaboration, communication and business processes. He provides his customers applications based on standard features as well as development or combining the power of several microsoft tools like Dynamics CRM. In his free time he tries to collect tipps and worthy experience in this blog.

Submit comment

Allowed HTML tags: <a href="">google</a> <strong>bold</strong> <em>emphasized</em> <code>code</code> <blockquote>

Please fill in the captcha: * Time limit is exhausted. Please reload CAPTCHA.