Not sure how to explain it but here goes.
I have 2 projects that reference SQLite. 1 is for Windows and 1 is for Windows Phone.
Now i need to create a class library for each platform, and reference the correct SQLite project for each. Ideally i would like to create my code in one place and then reference it in each project. Problem is my code uses SQLite.
I do not really want to have a separate copy in each project for each platform.
Can i do what i want, or not possible?
I only thought i maybe able to because if i create a windows application using cordova, it somehow creates 3 projects, 1 for windows, 1 for phone and the other has its shared resources in.
Here is a the sort of thing of what i would like
SQLite - Windows SQLite - Phone
Library - Windows (references SQLite Windows) Library - Phone (references SQLite Phone) Library - Shared (shared code that both library projects can use)
Cordova - Windows (references Library Windows) Cordova - Phone (references Library Phone) Cordova - Shared (shared resources that both cordova projects can use)
This is all because the SQLite cannot run on both WIndows and Phone, so need a separate project for each
If you put the code you want shared into its own project, you can then reference that in your other two projects (Windows and Cordova).
This will allow you to only write the code that they share once, while keeping the platform specific code separate.
You can put them all in one solution in Visual Studio, to help keep everything together. This also lets you easily reference the shared project.
Use file linking in the project.
This is an old Silverlight trick to share one set of code between two projects or two different versions of the CLR.
Create the code in project 1. Then for project 2, add the files by linking them from project 1. To do that type of add link this is the process:
The trick is to include as a link into the project. Here is how
Add
then Existing Item...
or shift alt A .Add
button select the drop down arrow. Select Add as link
to add the common files(s) as a link into the project.
That will give access to the file as if the file was actually within the project, but the file physically resides elsewhere.
You can: 1. create a base shared library referenced by the two projects (Windows and Windows Phone). 2. create two other libraries (that extends the base library) compiled for the specific platform. 3. on runtime you can load by reflection the right library you need on each project
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.