Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
498 views
in Technique[技术] by (71.8m points)

android - Xamarin whitelabel apps

I'm investigating Xamarin solution for my project.

Project requirements are:

  • IOS app,

  • Android app,

  • MacOS app,

  • Windows 7,8,10 app.

I already build test solution based on MvvmCross and it works fine.

My question is, how can I build whitelabel apps for all platforms that will be based on my test solution? In those apps I will change only resources, such as Strings, icons, fonts...and so on, but logic, views and UI will be the same.

Is there any way to do it like gradle in android (build variants) ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

MSBuild has a lot of features and can certainly achieve something similar to what gradle has with build variants. However, it is complicated to dive into that stuff if you don't have a background with MSBuild.

I think this might be the easier approach (and what I would do):

  • Use projects to organize everything
  • Keep all your cross-platform code in a Shared project (or PCL)
  • Keep all Windows, iOS, Android-specific code in a Shared project for each platform
  • Make a startup project for each flavor/platform of your app, referencing the shared projects. If you wish, include preprocessor defines for each flavor of your app.

In the startup projects you can include different string resources, images, etc. Also look into how to use "file-linking" in Visual Studio/Xamarin Studio, as it will help you out of tight spots here--especially if the different flavors of your app vary in different ways.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...