Alex Rivera | Logout

What is the best practice for compiling Silverlight and WPF in one project?

Asked 2008-10-16T11:07:24.420
12

I've just completed a Silverlight project and it's time to have a little clean up. I'd like to take my core files and put them into a separate project which I will reference from my main Silverlight app. Some of these classes are compatible with WPF and I would quite like to be able to have Silverlight / WPF code all in one project. My ideal solution would be a single project that allows multiple configurations. So,

Configuration: Silverlight would generate: Company.Controls.Silverlight.dll

Configuration: WPF would generate: Company.Controls.Wpf.dll

Is it possible to have the same source in the same file just seperated via defines?

Has anyone done this before?

Edit: I've created a solution per project, like MyCompany.Windows.Controls, which then contains 2 projects, MyCompany.Windows.Controls & MyCompany.Windows.Controls.Silverlight. Alongside those 2 folders I have a "Shared" folder, which contains files used by both projects. It works well so far :)

Edit
Report

1 Answer

3

You should check out "patterns & practices: Composite WPF and Silverlight"

http://www.codeplex.com/CompositeWPF/Wiki/View.aspx?title=Home

It has quick starts with WPF/Silvelight versions of the same app in one solution. Also a "Project Linker" that updates the source of your WPF app when you change Silverlight code (or vice versa) using linking. It can be overridden when you have version specific code.

The examples are still a little rough around the edges but it may give you an idea of how to go about your project.

HTH

answered 2008-11-12T23:17:17.827

Your Answer