By default when you add custom C# code to form InfoPath opens it from C:\users\user\InfoPath Projects path. I would like to move it C:\Dev\InfoPath and create git repo. When I open Form and go to File->Form Options->Programming I can change the path to .csproj file. But after I save it, close it and open it again and try to edit code it gives me error telling that The system cannot find the file specified. It doesn't tell me what file.

The worst thing is that it worked for 3 forms already and I can't do it for next one. It seems completely random.

EDIT: After more investigation using Process Monitor I see that when I click to edit code it looks in correct folder but is looking for old project name. I published source files to verify if they contain old project name but they're not. They point to correct csproj file.

<xsf2:managedCode projectPath="C:\dev\MyFolder\Code\MyNewForm.csproj" language="CSharp" version="15.0" enabled="yes"></xsf2:managedCode>

Yet Infopath designer is looking for C:\dev\MyFolder\Code\MyOldForm.csproj

1 Answer 1


You might have issue with IP form. for best effect never re-use the old form. I know it goes against the common sense but you will have less issues in long term if you start with a blank form. You can try to review the internals of the form. In Infopath you have an option to export the form, that crates an folder structure. those are mainly xml files. you can then review them, find where the old path is stored update it and then open and save that form again. It should hold now the value for your custom c#

  • This is exactly what I did. None of the source files contains name of old project. They contain new project name as expected. Apr 4, 2019 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.