Question

I have a solution with many projects. One project contain few custom components. One of these components is used to display a title on an image. We can change the color of the background and many other things.

The problem is IF I decide to change the default color of the background of the component or change the position of the text, thoses change won't reflect in all other projects of the solution where the component is used. I have compilent the project of the component and all other projects Reference the component by the Project.

For the moment, what I have to do is to take off the component from the other project one by one and to add it back, then all is fine. Do you have a quick way to do it?

UPDATE I have added a CheckBox inside that component and it seems that the checkbox is everywhere! Fine! But when a property has a some tag that let the component to change (example like the Background color) it doesn't change the "default" value but instead put the old value as a changed value in the property. So, I see the old value setted like if I add manually changed the color in the Properties panel when I haven't...

UPDATE 2 alt text http://img517.imageshack.us/img517/9112/oldonenewoneei0.png

Update 3:

This problem is still here. Just to let people know that I am still curious to find a way.

I have tried few of your suggestions.

  1. If I clean all the solution and build only the project that has the Custom control then I build the solution. Nothing change (To test it, I have change the color of the component to Yellow. Nothing change : fail.
  2. If I remove the reference and add it back to the project and then rebuild the solution. I can see the old color in the designer : fail.

I have updated the question with more information and an image (above) for those who want to try to help me.

As you can see, the old "compile" of the component show the Yellow background but when I insert a new component (from the Left Tool bar in Visual Studio) I can have the new component with the supposed WHITE background...

Was it helpful?

Solution

This is most likely due to references.

Your other projects probably copy in a reference to your component project. You'll have to rebuild these other projects for them to re-copy in the referenced component project, if it has changed. It is only updated at build time.

You can somewhat get around this by having them part of the same solution. In that case, you can set up your project dependencies correctly and it should handle things for you mostly automatically. But having everything in the same solution isn't always the right thing to do.

If you already have them part of the same solution or it's not a references problem, it might be due to component serialization. We've run into this quirk a lot when doing custom control development.

OTHER TIPS

My guess is that the designer is smart and remembers the settings for the component as you have it in the designer and thus sees it as the default.

This doesn't sound usual. Right clicking on the solution and hitting "Clean Solution" might help (it will delete all dlls and executables from each project's bin directory, which forces fresh builds to occur)

You might also want to check your build order sequence.

I work on a project that has a similar problem, I have found that if you touch the .NET config file or assembly information file (depending on your project type). The other projects will then reflect the component change...

I'm not sure why this happens, but this is how I overcome it...

Recently I have switch to building everything via Nant, and that takes care of the problem altogether.

Sometimes the Visual Designer serialize all your properties in the code-behind, even if they have the default value.

If your component have a default backcolor of Red, and you change the default backcolor to Blue, the components that use your component will change it back to Red.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top