views:

98

answers:

1

Does anyone know of a tool or a way within Visual Studio 2010 to convert a Silverlight 4 class library project to a Windows Phone 7 Class Library project?

I could resort to copying and pasting class files, but if I can avoid that with a conversion tool, that would save all kinds of time.

Steve

+2  A: 
  1. Create a new class library for Silverlight for Windows Phone 7 using the project template in Visual Studio 2010/Express with the Windows Phone Developer Tools installed
  2. For each of the source files in the class library, use the option to Add an Existing Item... and the use the Add As Link option in the Add button
  3. Compile the class library to see if there are any issues
  4. Add the Windows Phone assemblies as needed
  5. For Windows Phone specific issues, use #if WINDOWS_PHONE directives

You can see two open source projects that do that here:

  1. New York Times Silverlight Kit
  2. Microsoft Silverlight Analytics Framework
Michael S. Scherotter
Thanks for the idea, Michael. But that seems like even more work than copying and pasting the classes into the new class project.
Steve Danner
There's also project linker to link two projects to avoid doing the add as link manipulation for *new* files : http://compositewpf.codeplex.com/Thread/View.aspx?ThreadId=73989
Matthieu
I concur with Michael's assessment. It may seem like some work to setup, but realistically how else are you going to achieve the requirements in the OP without incurring the deferred costs of duplicated code. I think it was a good question to ask, to avoid duplicating code. A worthwhile pursuit.
Mick N