dllreference.net-2.0infopathvsta

Missing reference to System.Windows.Forms on VSTA project startup


I have an InfoPath form with a code-behind C# solution. Every time I open the form (design mode) and open the Visual Studio Tools for Applications (VSTA), the reference to System.Windows.Forms is missing from the project. When I add it manually everything works. I also tried setting the property Copy Local to true or copy the dll-file in a folder and set that property to true, but this doesn't work either. Does anyone have an idea how I can solve this?


Solution

  • I had a similar issue. I resolved it by creating a copy of the project files folder, renaming it and then using the "remove code" option from within form options to strip out the old code. Then saved the form without code, re-opened it and attached the newly created copy of the project files folder.

    Not sure if that's exactly the same as what you are experiencing, but it definitely worked for me on multiple forms.

    Good luck!