c# - Copy User Control from one project to another within same solution -
occasionally, c# project have user control in belongs c# project , have move over. attempting copy + paste user control on results in namespace errors. let's project 1 has namespace of namespace general.category1.controls
, project 2 has namespace of namespace general.category2.controls
.
the steps took were:
1) copy + paste control (which includes .cs
, designer.cs
, .resx
files) project 1 project 2
2) change namespace project 2's namespace general.category2.controls
at point upon building, received additional errors forms on control used before copy + paste states 'the type of namespace name 'usercontrol1' not exist in namespace 'general.category1.controls' (are missing assembly reference?)
. turns out designer.cs
form files did not update correct namespace after copy + paste.
so add add additional step:
3) change declarations match new namespace of general.category2.controls
aka private general.category2.controls usercontrol usercontrol1;
i'm confused why designer.cs
files wouldn't have updated since it's not advised edit designer.cs
files. again, maybe it's ok modify them long don't touch initializecomponent()
method states in actual file itself.
in conclusion, why of designer.cs
not update automatically? actual answer know control used , update declarations myself have done?
[edit]: first 2 steps control (it's .cs
, .designer.cs
files). 3rd step associated forms in control placed on before copying on because still using old namespace, of form .designer.cs
files must changed well.
Comments
Post a Comment