How to factorize definition of C# projects (csproj) between platforms (MonoTouch/-Droid/WP7)
I'm planning to develop a distributed application with a mobile part (MonoTouch/MonoDroid/WP7), a desktop part (WPF) and the web part (ASP/Silverlight)...
Of course a good bit of code is shared in more than one platform. Up to now to create 1 project per 1 platform, I took the hitchhiker's way, I've the WPF csproj, let's create a Silverlight one and put the cs file in it. Then I do the same for MonoTouch. Then for MonoDroid. Then for WP7. Is it possible to factorize the content o开发者_如何学Pythonf the csproj in some way? And how to optimize the project creation?
I would not discuss the fact that 1 project per platform is required. What I'm dreaming of is a description which file for which platform in ONE file. Then that file is included in each csproj...
Cheers, Patrick
Here is great extension that will help you http://msdn.microsoft.com/en-us/library/ff921108%28v=pandp.20%29.aspx
I am using it for sharing code between MonoDroid, MonoTouch and WP7 project
Wouldn't it make sense to place common code into a class library project that you then reference from each of the others?
If you want to share code between several devices I suggest your look at the MVC pattern, using something like MonoCross.
As ChrisDB suggested try to share at a level project, not a the file level. Doing the sharing at the project-level will be much easier since:
- many tools (e.g. MonoTouch with MonoDevelop/XCode integration) will be using several files for the UI (a lot of them autogenerated) and you do not want to lose the IDE help for each platform;
- your IDE (VS.NET or MonoDevelop) will be able to keep different options for each project (e.g. defines or custom project options, e.g. MonoTouch);
You might also want to check on the What contraints should I be aware of to maximize portability of Mono code? question / answers since it's a bit similar, but not identical, to your current request.
精彩评论