开发者

WPF and NET 3.5 to 4 multi-targeting

开发者 https://www.devze.com 2023-01-29 01:18 出处:网络
I have a WPF 3.5 library of controls working with a WPF 3.5 applicat开发者_StackOverflowion. I would now like to create a WPF 4 version of the application and use the same library (source code) for bo

I have a WPF 3.5 library of controls working with a WPF 3.5 applicat开发者_StackOverflowion. 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.


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.

WPF and NET 3.5 to 4 multi-targeting


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.
0

精彩评论

暂无评论...
验证码 换一张
取 消