5

Context: I'm creating some applications to help me on my daily tasks, it does not connect anywhere and the only "data" it has to deal with is the parameters that I enter on the input fields.

This is how I structured my solution:

|- Helpers (Folder + Class Library)
|- Core (Folder + Class Library)
|- Shared (Folder + Shared project)
|- Apps (Folder + WPF Projects)
|---- App1 (WPF Project)
|---- App2 (WPF Project)
|---- App3 (WPF Project)

While developing the first application (App1) I've created a few UserControls. Now I want to use those user controls on the second application (App2).

Question is: Should I create a new project to hold all these UserControls and reference it from App1, App2 and App3? Should it be a WPF Project?

If not, what should I do?

Additional info: I'm using MVVM.

Thank you!

2 Answers 2

4

Should I create a new project to hold all these UserControls and reference it from App1, App2 and App3?

That's the general idea, yes. Anytime you have functionality that is common to several projects, the way you prevent code duplication is by putting the common functionality into its own assembly.

5
  • Thank you for your answer Robert. Just one thing: In this case, where the common functionality is a (WPF) user control, should the new assembly be a WPF Project, or it should be a Class Library with all the necessary references? Commented Nov 30, 2016 at 15:35
  • 1
    Which approach most effectively meets your requirements? Commented Nov 30, 2016 at 15:36
  • A new WPF Project, probably Commented Nov 30, 2016 at 15:37
  • There you go... Commented Nov 30, 2016 at 15:38
  • 1
    All right! Thank you a lot for your time and patience! Commented Nov 30, 2016 at 15:40
3

Yes you should, if you know you will use something on multiple projects you want to make it easily portable. From my previous experiences, you really want to give you easy access to things you have already done in order to avoid duplication.

1
  • All right. Thanks a lot for your advice. I'll surely follow it! Commented Dec 1, 2016 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.