3

I have a WPF 3.5 library of controls working with a WPF 3.5 application. I would now like to create a WPF 4 version of the application and use the same library (source code) for both versions 3.5 and 4 of the app.

What are my options here? What are the common ways (if any) of handling this type of multi-targeting?

Should I maintain two distinct projects for the WPF 3.5 and WPF 4 versions of the library with reference to the same files/source code (with manual updates to both projects)? Or should I maintain just WPF 3.5 version and in my WPF 4 app reference a binary WPF 3.5 library?

I have tried the latter and found out that this might work with some "app.config remapping" but I would not have the ability to directly access source code of WPF 3.5 library from a WPF 4 project.

Any pointers are appreciated.

EDIT: NET 3.5 project/solution must be maintained in VS2008 while the NET 4 solution is maintained in VS2010.

wpfwannabe
  • 14,587
  • 16
  • 78
  • 129

2 Answers2

2

Just have one solution with 2 projects:
Project 1: Your WPF Control library project targeting 3.5
Project 2: Your WPF 4.0 version of the app targeting 4.0.

There is nothing wrong with that, it's very simple to do and you can have direct references from the 4.0 to the 3.5 project.

alt text

Michel Triana
  • 2,486
  • 1
  • 22
  • 31
0

Links to sourcecode just suck. Try to avoid that whenever you can.

In general I see the following options:

  1. Create distinct Project/Solution files in the same folder (one for VS2010 another for VS2008)
  2. Mantain your lib within VS2008, link it as a binary reference. Attention: you might need to set the application target framework to 4.0 client profile instead of "plain" 4.0.
Tim Lloyd
  • 37,954
  • 10
  • 100
  • 130
Jaster
  • 8,255
  • 3
  • 34
  • 60
  • @Point1: You have vs2008 project files. You add an empty project using vs2010 at the same location where the 2008 project is located. now you add all those code files to the vs2010 project. – Jaster Dec 07 '10 at 15:00
  • Code linking is always a source for huuuuuuuge mistakes. You never know where your file is linked or how it is reused. You simply rip out a part of your libary and reuse it somewhere completly different. Depending on your source control you have to handle links in different ways and this causes nasty sideeffects. For the particular scenario there is simply no need for links! – Jaster Dec 07 '10 at 15:03
  • There are issues! also if the file is marked within the studio as a link an copy is made. You work on the copy that is then synchronized. Add a sourcecontrol to this and you will see how "great" sourcefile links are... Really, don't do it! – Jaster Dec 07 '10 at 16:47
  • Thats not my point. I usually work in huge teams, where the "technique" you use have to be as stable as possible. File links are the opposite. However if you work alone or in a small team where evereybody is 100% sure of what he is doing, feeld free using links. Still you don't need them for what you are intending to do, so why bring them in? – Jaster Dec 07 '10 at 17:21