Anton Sizikov
Anton Sizikov

Reputation: 9240

Share dll between WP7 and WP8 application

Usually it is recommended to have two projects for both wp7 and wp8 platforms. Wp7 project contains .cs and .xaml files, and WP8 project contains links to that files.

I think that there is no reason to compile non-platform specific business logic code twice, since it can be referenced to WP8 project.

I'm thinking about following solution structure:

Such application can be compiled and I can deploy it to device/emulator.

The question is: will this app pass certification in Windows phone store? Or it is necessary to recompile shared dll?

UPD: My crazy idea was born after this steps:

  1. Create new WP7 app (WindowsPhoneApplication1)
  2. Create class library targeted to WP7 (WindowsPhoneClassLibrary1) Use it in WindowsPhoneApplication1
  3. Use Upgrade to WP8 menu. WindowsPhoneApplication1 will be updated to WP8, but the referenced project will be still targeted to WP7!
  4. Such app can be deployed to WP8 devices.

Upvotes: 0

Views: 241

Answers (2)

Anton Sizikov
Anton Sizikov

Reputation: 9240

Thanks to Claus, I made some research, and it looks like the answer is - you can use such solution.

I didn't find related information in documentation, but here is a proof from one of MSFT tech. evangelists from Netherlands: link to blogpost

The basic idea is to move all our code that can be used from both our existing Windows Phone 7 app as well as the Windows Phone 8 build, which we will add soon, to a Common project in the solution. The bad thing about this approach is that we have to create the Common project as a Windows Phone 7 class library, which will be used in our Windows Phone 8 build. I haven’t really noticed any negative impact of this decision in my existing apps, but note that you will be referencing a Windows Phone 7 library in your Windows Phone 8 build.

So it is a possible, but not the best solution.

Upvotes: 1

Claus Jørgensen
Claus Jørgensen

Reputation: 26344

Unless you use a Portable Class Library, you'll need to have separate project files, and compile separately for WP7 and WP8.

Upvotes: 3

Related Questions