Xamarin.Android change app package name dynamically - xamarin

i want to change the package name for Android project dynamically related to selected configuration in Visual Studio.
For example, if i want to have same app twice in Google Play Store, one with postfix full and one with postfix free. So i want to have one configuration for release full and one for release free, without changing the package name manually each time i select a configuration.
A more complex scenario could include also changing app icon and app name.
Is there a smart way to do this? Maybe a Nuget plugin?
Best regards,
Moritz.

Related

How to list NuGet packages used in my project programatically with Xamarin.Forms?

In order to print them in the legal info of the app, I'd like to recover all the used packages in the app along with their version and the repo that contains them.
So, is there anything within the framework that allows me to recover programmatically (from c#) the info you see on the Nuget Package Manager for each package in the project?
This is the info that we would like:
But only the name, version, and Project URL would be alright too...
You can get all the needed information from YourProject.csproj file.
Thanks!
even you can use NuGet Server API for get extra information API

Create a MSIX bundle containing a UWP app and a Windows service

I have read in some threads that MSIX will start to support also windows services from the January build. But I only seem to find information of how to migrate an existing installer containing a service to MSIX. How should I do if I want to create a completely new MSIX bundle from scratch, containing a UWP project and a Windows Service? I can´t seem to find no information about this no matter how much i search. If someone have succeeded in this it would be vary appriciated to hear how you did this!
I have a sollution in visual studio containing  a UWP project and a Windows Service Project. I try to simply add those two projects to a new windows application packaging project but no matter how I do this I only manage to install the UWP app from the created bundle. Is it still not possible to include the Service project in my MSIX? I get no errors when I build my sollution. I have simply added the UWP project and the service under "Applications" in my windows Application Packaging project.
I have also read that background tasks may be prefered to services in msix packages. But I am afraid that a background task may be a bit too limitied for my intentions. My main requirement for a service is not to have something running in the background, but to access functions outside the UWP sandbox. Like USB storage and other functionality. But maybe this can be achieved by a background task as well?
Maybe the MSIX sollution is a bad idea in my case, do you think I need to relay on some other packaging sollution for my projects instead? Like Wix or similar? I have very little experience in packaging installations so I prefer a tool that is as simple as possible.
The recommendation for apps in development is to use background tasks instead of trying to add a Windows Service. 
For the case where you're trying to access content outside the UWP container, you can consider adding a desktop extension component to your UWP package and then using that for your required functionality. Have a look at this blog post for more details - https://stefanwick.com/2018/04/06/uwp-with-desktop-extension-part-1/

Is it possible to structure a Xamarin multiplatform app project for different customers?

right now I am maintaining a Xamarin Multiplatform app that only had to satisfy the needs of one customer.
My Visual Studio Solution consists of a Core project with ViewModels and resources as well as an iOS and an Android project with the UIs and platform specific code.
I now have to release the same app for a different customer with only slight changes.
So I was wondering, is there any possibility to have another iOS and android application that 'extends' my other projects, so that I can just override the parts that need changes?
I'm asking because I saw web applications that satisfy just exactly that issues by just including another project and than overriding different services for example.
Yes there are a lot of ways to do that. Here are just two that came to the top of my head.
Method 1: Multiple Build configs (Intermediate level)
One way is to create multiple build configurations, and select what code is to be run depending on which build you are running.
Basically to do this, and assuming you are using a Mac, and that all the data your UI uses comes from your ViewModels in your Core project. Then
in you Core project settings, go to Configurations and select Release and Click on Copy, and then type in the client name.
Then go to Compiler, Select the client configuration, Add a Define Symbol as shown and press OK
Then in your ViewModel, add your Company specific code using the symbol you defined for the client. Depending on your build configuration, Visual Studio tells you which code will be build using darker colors
Then go to Solution properties->Configurations->General->Add three for each customer/client (once for Android (any CPU), one for iPhone and one for iPhone Simulator).
So it should look like this - Client1, Client1|iPhone, Client1|iPhoneSimulator, Client2,
Client2|iPhone, Client2|iPhoneSimulator. Make sure that "Create
configurations for all solution items" is not checked.
Then, go to the Configuration Mappings tab, select Client1 & Client2 and make sure the right projects are going to be built depending on the Platform selected. And make sure the right Configuration of each Project is appropriate (Debug vs Release). In our case, only the Viewmodels needed client specific code, so the rest of the projects build correctly. . Press Ok et puis voila!
Method 2: Azure Devops (Expert level)
If you want to do automate the entire process from commit to publish, Scott MacDougall, a developer, presented at a Toronto Xamarin Meetup shared exactly how you can resolve this problem using Azure Devops to manage over 10 apps that were to be released to different iOS & Android accounts. He would just makes the change once, and then once the ticket/issue/item/task was approved by QA, it would go right into each store. It is a lot more complicated and I would have to study it more to explain it to you.
If these changes also include some logic, then I would also go with creating multiple Build configurations and using if directives.
Then in your code you can have something like:
private void ExecuteApiCall()
{
#if COMPANY1
//do something
#elif COMPANY2
//do something else
#else
//do else
}
If it only requires some UI changes, you can also think about having multiple themes and then just assigning one to specific customer:
https://medium.com/#milan.gohil/adding-themes-to-your-xamarin-forms-app-3da3032cc3a1

Is it possible to deploy aspnet vnext to azure from a mac?

The kpm pack command needs the runtime for the server - is it possible to install windows runtimes on osx just for the pack and deploy?
Ok, it seems that in order to recognise that the deployment is an aspnet vNext project and to handle that as a 'ProjectK Web Application deployment', you have to make it look like it all came from Visual Studio (or at least that was the only way I managed to get it to work right now)...
I did this by taking an example one from somewhere else...
I took a simple single vnext web project .sln file and changed the project name and project GUID.
I took the .kproj Visual Studio project file and did the same.
There isn't much that needs to be changed - only the name of the project and GUID. It's nice that there isn't any file lists in there so I feel that this might end up as a once-only activity...
I did find that there are some project structure rules that seemed to make it break. You seem to have to have the sln file in the top level folder and a folder underneath for the web project. If there is ONLY a web project then this might seem overkill, but I tried collapsing everything up to the top with the sln file correctly pointing, but that didn't work.
The other thing that you need to make sure you have is a reference to "Microsoft.AspNet.Server.IIS" in the project.json dependencies. Without this, the AspNet.Loader.dll and bin folder don't get deployed.
Apart from that, I am now able to use Sublime Text (or whatever I want on osx), test using "k kestrel", checkin through git and it gets deployed automatically to an azure web site! yippee!
Actually this makes much more sense because it is letting the target decide upon the binaries it needs to satisfy the deployments. Next challenge might be to get it to pull 'my' libraries from a custom NuGet source to get my binary libraries in there and avoid uploading ALL of the source to the website!
Oh - and another tip: Quit kestrel with 'Enter' for a clean quit instead of Z which leaves the port listening but non-functional!

How do I add CRRedist2008_x86.msi to Visual Studio Deployment Project?

I need to add CRRedist2008_x86.msi to my deployment project as it is a requirement for my app. However, I want it to run automatically. I don't want it to be just added as a file and then the user has to click on it for it to run after my app installs. Can someone guide my on how to do this? It seems like it should be very easy but for some reason I am missing something.
What you need to do is set it up as a "merge module" in your deployment project. Instead of the .msi, find the.msm file that should be available on the CR website. Then in your deployement project, right click the Project and select Add->Merge Module. Browse for the file and you are set.
When the installer runs, it will automatically unpack the crystal reports related items and install them for you. You may also need a key file, depending on the licensing of the application involved.

Resources