I have a Xamarin Forms project supporting iOS / Droid.
The solution also contains the PCL and two other external references.
I'm asked to create different language versions, meaning one .ipa / .apk per language.
In every project (language) only some files have to be changed (images / props on helper classes)
Is it possible to reuse the same files from my original project and just add the different files?
I have seen it working on Windows Phone but can't get it on XF.
Any ideas ?
P.S: I want to avoid copying 4 times each project.
Regards.
You should use resource file, it support images
https://developer.xamarin.com/guides/xamarin-forms/advanced/localization/
Related
I'm creating a RN app that is meant to be some kind of wrapper. It should have multiple targets (like in Xcode) and all its content (images, text, etc.) should be target dependent. Unfortunately, I cannot find any useful informations about how to achieve this without opening Xcode or Android Studio project and create those targets manually (like here). Is there any other solutions for this?
I was still struggling with described problem but I finally found a solution. It's not easy, needs writing a bit of boilerplate code and looks more like a workaround but I hope it will help someone in the future. What I did is I have completed my wrapper app with the resources for one of my targets so I can have visual effect. In the project's root directory I've created a folder with subfolders for each target. Inside each I have put files (images, source code files, other assets) that are target-dependent. Then I've created bash script that takes one argument - target's name. Based on it, it replaces all the target-dependent files from target's subfolder to the original file's destination in the project structure. In this proces all meta-data informations are also replaced so after firing .sh file I can build the app and upload it to both stores. It's really time consuming to create all these apps separately and publish them and it's maybe not the best solution, but at least it works!
On android, you can edit build.gradle files, java or properties, without having to launch Android Studio (which simply uses Gradle)
You can build different type flavours by only changing app/build.gradle
On iOS, that's another story. Project file (.pbxproj) is a mess,and other Workspace/Scheme files are not easy to read or script. So XCode is the way to Go.
I tried to have dynamic target & Info.plist, there are tools to script that like PlistBuddy
in the end, I saw there are many ways to launch a React Native app for developpers. Some prefer the command line, and only VSCode.
Others want to play with native IDE.
By the way, native IDEs are VERY useful.
e.g. : you want to fine-tune your application performance, using XCode view hierarchy debugger or android Studio Layout Inspector (and be sure you don't use to many views), or use any other performance tools these IDEs offer...
In the end, I used react-native-config along with multiple almost similar configs (Info.plist < target < Scheme for each), here's a post giving an overview of the setup.
I'd like to use the same images in multiple device apps in Xamarin.
I have a PCL core library and have started using MVVMCross.
What's the best approach to accomplish this? Can I embed them as a resource in the Core library and access it in my Andriod/iOs project, or is it better to use add as link?
You can in theory embed these as binary resources in the PCL project and can then access them as byte[] via GetResourceStream and from there can then get them decoded in your UI projects. This would require some work to setup and would make it impossible to use the images in the xib editor, in the android XML, etc
More easily, you can also share these image files using 'Add as link' and then allow each individual platform to optimize and package the files - each platform is good at this - eg Android with its different dpi drawable folders and IOS with its 2x image packaging. This technique also works well with the xib and XML designers.
However, in practice I generally find I don't share these image files between projects - instead on most commercial projects, the PhotoShop guys insist on giving me icons, dividers, and other chrome images which are unique to each platform.
I am building an app for windows phone sdk 7.0 and 7.1, I want to have some extra features for 7.1, but I want to maintain only one code base for both, and only have some code appear if user's phone is 7.1.
I read about Shawn Wildermuth's post: http://wildermuth.com/2011/08/23/Maintaining_a_Project_with_Two_Windows_Phone_Versions. But I am not sure how to do "First off, I took my original project and created two solution folders and created the 7.1 projects as shown here" mentioned in the post.
Could someone help? or suggest other ideas?
Thank you.
The perfect solution is preprocessor directives
[Updated 11/5/2011: removed outdated information about the Marketplace. Thanks for the udpated info #johnforrest]
To do what Shawn is describing take your existing solution with your existing 7.0 project(s). Add a solution folder and name it "7.0". Move your existing 7.0 projects into that solution folder. Make another solution folder named "7.1". For each project in the 7.0 solution folder, create a new matching project in the 7.1 solution folder. These are Shawn's PhonyTools.7.1 and so on. Now follow his directions for populating the 7.1 projects with linked files that are linked from the 7.0 projects.
I find linked files to be a blessing and a curse. If you open the linked file in one project and edit it, Visual Studio does not alway know that the other project containing the linked file needs to be rebuilt. Lately, I've been finding that if I remember to then open the linked file in the other project I will get a warning that the file is opened in another project, but then VS recognizes that the file has changed and will rebuild the other project.
Preprocessor directives, as suggested by #KevinDTimm, don't solve the problem all by themselves, because you still need two different projects for the two different types of projects (7.0 and 7.1 apps or libraries). Additionally the different versions of the apps will reference different corresponding versions of assemblies.
Lastly, while we're on the topic of conditional compilation, don't forget the Conditional attribute, which is often a much better solution than using preprocessor directives. Bill Wagner gives a good description of the merits of the [Conditional] attribute in Effective C#, 2nd ed., item 4, p. 20. Enjoy!
In Xcode 4 I want to use the workspace to have multiple project types and have these projects reference static libraries which will hold common functions like data access code etc.
Is it therefore possible (or correct) to have a Mac/iPhone/iPad project in the same workspace and have each reference static libraries (also in the workspace) just like you can do with a Microsoft Visual Studio Solution.
Or is it that a workspace should contain one application type, say a Mac application, and then include the static libraries into each workspace, thus ending up with 3 workspace projects one for each of my target platforms?
Many thanks.
You can mix any projects whatsoever. There's no limitation or warning against different platform types - in fact, Workspaces are there with this (shared library between a Mac OS and iOS application, each in its own project) in mind.
The only thing you need to worry about is how to manage your build schemes. That is, do you want to build all products of all projects each time this scheme is run, and which executable to run among all those projects when you hit "run", etc.
This might help Building Static Libraries to Share Code on iPhone AND Mac OS X Projects and another similar question here on SO How do you create hybrid XCode projects for Mac & iPhone?
My compact framework application is generating a ...asmmeta.dll file in the output folder. What exactly are these files and why are they created? I have made compact framework applications in the past and it hasn't created any files like this.
One possible reason (you've not said a lot about what you're building) may be that you have USerControls or custom controls of some sort. In that case, the asmeta files are created for Studio designer support of those controls. Do you also have an XMTA file in the project?