tags:

views:

40

answers:

1

Hi:

I have an XBAP (WPF on browser) application that I want to run as a standalone application and also in the browser. How can I do that without making a lot of code changes, since going forward we will be doing a lot of modifications to the code anyway. And it is not a good idea to maintain 2 different codebases for that.

thanks, PN

+2  A: 

I would have 2 Projects under one Solution. One for Project.Web and one for Project.Desktop. Assuming you already have Project.Web underway and are adding Project.Desktop as new, use Visual Studio's "Add As Link" when adding files from Web to Desktop. This will maintain 1 copy of each file.

Host your main UI in a UserControl, then add that UserControl to the Project.Web.Page1 (or whatever it's called) and Project.Desktop.MainWindow. If you modularize your program sufficiently, you won't have to worry about maintaining 2 projects since they will both be thin shells atop your main UserControl.

bufferz
+1 - For the "Add As Link". I can't believe all this time what I wanted was right in front of me (only slightly hidden).
Joel B
It's too hidden IMO. There should really be an "Add as Link" button right beside the regular "Add" button. Every developer remembers where he/she was at the moment they got burned by that hidden button.
bufferz