I have 开发者_StackOverflow社区a MVC project which has a separate Model class library. now we are managing to add a windows phone 7 application for it. when I try to add my Model project as a reference, it gives me error:
“Reference cannot be added because the dll was not built using Windows phone runtime. Windows phone projects will only work with windows phone assemblies.. ”
Now I understand this is because of the assemblies are actually different between CLR and windows phone 7, however what is the best practice of centralising code in one place instead of have 2 projects having nearly exactly same source code.
I am using entity framework 4.0 as well.
There are lots of options available.
The simplest is to share/link the source files between the two projects. This does require that the files/classes/models you share can be compiled on both platforms though.
My second choice would be to create WP7 specific versions of the classes and map them to your server side ones with Automapper.
精彩评论