Dealing with InfoPath Form Templates in Visual Studio 2008 with TFS
Posted
Monday, January 12, 2009 1:20 PM
by
CoreyRoth
I have been building a large number of InfoPath Form Templates in Visual Studio 2008 lately and I have discovered it is can be quite the exercise in frustration when you want to put your files in TFS (or any source control for that matter). There are a number of reasons for this, but it all starts with the fact that the form template designer does not like it when files are read only. Unlike other project types that will automatically check out files that are needed, the InfoPath form template project will not do this.
Before, you begin working with an InfoPath template file in source control, be sure that you checkout (at a minimum) manifest.xsf. For some reason any time you compile, this file must be checked out. On top of that, if you want to publish your form, it seems to require that this file is checked out in all other form projects in your solution. It looks like it does a build solution prior to launch the publish form template dialog. As you are editing your form, other files in the project will more than likely need to be modified, so my recommendation is that you check the entire project.
As you are working, you might come to a point where you receive an error like the following when trying to save your file.
InfoPath cannot save the following form: InfoPath Form Template. The form is read-only.
When this occurs, it really is a bad time because every time I have received it, the form was already checked out and not marked read only. The only solution I have found for this is to close Visual Studio and restart it. This can be particularly frustrating when you have made a bunch of changes to the form template as you will end up losing them. For this reason, I have made a practice of attempting to save the form, before I start making any changes to it.
Another error that you may often run into is the following.
The operation cannot be completed.
This can occur when trying to publish or when trying to open the manifest.xsf file. When this occurs, your best bet is to make sure all files in the project are checked out and restart Visual Studio. If you are lucky, you will be able to open the form or publish it again. If not, my recommendation is to go back to a previous version and hope for the best.
Another issue you might run into occurs when checking in. If you try to check your files in while you still have manifest.xsf open in the form designer, you will get the following error.
The process cannot access the file 'MyTemplate.xsf' because it is being used by another process.
The designer seems to create a lock file so no external process can even read it. Just make sure you close the file first before you try to checkin and you will be good.