VS 2019 Designer Error

I feel like I may be doing something wrong here, but I’m trying to evaluate the Powershell Toosl using VS 2019.

I create a new project in VS 2019 > Powershell Windows Forms Project > Create a project name.

I’m at the initial project page showing my .ps1 file. I can right-click and choose View Designer and see the initial form, similar to a C# windows forms project.

If I then add a control or even resize the form, go back to the .ps1 file and so much as add a carriage return to the code page, and then go back to the designer I get a designer error page.

“Could not find type ‘System.Drawing.Size’. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built using settings for your current platform or Any CPU.”

Am I just doing something completely wrong here?

Click on the pic below to link to the imgur album with screenshots.

Oy. this is an annoying error that seems to come back after we fix it. The easiest work around it is to expand your project, right click on References and click Add Reference and then add a reference to System.Drawing.

The project system adds the reference but you may notice it has a yellow exclamation mark next to it. Usually, readding the reference manually allows the designer to load.

I’ll get this on the backlog to get fixed.

Oh Thank you so much for the quick response. I was confused because I did see the reference in the code but never thought to manually re-add the reference. I have done that and it is working now. I will get back to the evaluation. Thank you for the quick response, I should have just done this last week after I got my trial license, but I thought I was doing something wrong on the project.
Thank you again,

1 Like