Forms Designer Error in VS Studio 2017 & 2019

Hi Adam,

I just installed Visual Studio on my home machine and also in a virtual machine lab with both 2017 & 2019 versions. The VM instances I installed via the GUI setup and the home machine I used used your offline CMD line method to ensure I had all the required dependencies. PS Pro Tools extension is version 5.5.1

Loading a new project, everything seems OK where I can add controls to the form and change properties etc. I then double-clicked say a button to add an action and proceed to add code to that command block. But… when I return to the form I get the following errors:

I can dismiss the error and run the project successfully but the error persist if the file was saved and reloaded. I tried reinstalling missing target libraries and adding specific code to reference them with partial effect - the errors changed but I forget what they were and I have uninstalled 2019 from the home system.

PSScriptPad fares better although I get a bunch of errors if I try to run the code when the form designer tab is active - runs fine from the code tab.

Attached is one screenshot (I have more but I’m only allowed one currently). This happens in all VS instances including the one I installed on my home system yesterday with all current updates installed.

Any idea what is going on? Are there components missing?

Some of you may not be surprised to know that the solution was to add the missing reference - System.Drawing (yes, I am somewhat new to this). The questioned now is why this wasn’t added automatically? My work computer that has an identical setup but is running VS Professional (vs Community) adds the System.Drawing reference automatically - why not in my case?

2020-06-16 16_29_39-PowerShellFormProject3 - Microsoft Visual Studio

Hey @kenhamilton,

Seems like a bug in PoshTools to me. It should add that automatically when you add a new form to the project or create a project with the form project template. I’ll try and reproduce on my end. This used to be a problem before but the reference would be invalid and not missing all together but I thought it had been resolved.