views:

111

answers:

3

I have two C# .NET projects in my solution. One project is a DLL that contains a WinForms custom UserControl. The other project is a WinForms EXE that references and uses that UserControl on a Form.

I have added a handful of properties to the UserControl so that when I place the control on a form I can easily set these properties in the designer just like any other control.

All is well and good until I add a new property to the UserControl. The new property doesn't appear in the forms designer. I've tried doing a deep rebuild and reopening the solution.

I can manually go into the .designer.cs file and set the new property's value. The project will actually compile and run but the forms designer claims the property doesn't exist and will not open the form.

The only thing I've found that works is to close and restart visual studio. Is there any other way to see the new properties without restarting Visual Studio?

Edit I tried reproducing this in a clean solution and everything seemed to work. Then I remembered that in the the original solution the DLL is signed and installed to the GAC with a post-build step. I think the Visual Studio forms designer is loading the assembly from the GAC to reflect on it to get the list of properties. This is fine until I add new properties. I can build the assembly and install it again to the GAC but Visual Studio does not see the new properties.

A: 

Put the Browsable attribute on your property :

[Browsable(true)]
public string MyProperty { get; set; }

And of course, make sure it is declared as public...

Thomas Levesque
None of the existing properties actually had the Browsable attribute but I could still see them. They are all public. Even if I add the Browsable attribute to all of old and new properties I can still reproduce this problem .... but I learned something new, see my edit of the original question.
Brian Ensink
A: 

Maybe you can restart the VS 2008 solution? I have this problem and the only way I can solve it is to restart the VS 2008.

Ngu Soon Hui
Yes I did mention that was the only way I could get it to recognize the new properties. I am hoping for something better.
Brian Ensink
A: 

you can try to rebuild once again your DLL, remove and then add your reference to the main project.

serhio