Xamarin assists in delivering native Android, iOS, and Windows apps with a single shared .NET code base.
Xamarin tools are available for download on Visual Studio and one can directly create Android, iOS and Windows apps from Visual Studio. Most of the common codes are written in C#; hence, one doesn't need to be well versed in Java, Objective‐ C or Swift to build apps, if they know C#. If you are a beginner, then taking the Xamarin path, instead of the conventional learning process, can equip you to learn app development on various platforms. NuGet An essential tool for any modern development platform, NuGet is a mechanism through which developers can create, share, and consume useful code. More often than not, such code is bundled into "packages" that contain compiled code (as DLLs) along with other content needed in the projects that consume these packages. For .NET (including .NET Core & Xamarin), the Microsoft‐supported mechanism for sharing code is NuGet, which defines how packages for .NET are created, hosted and consumed & provide tools for each of those roles. Put simply, a NuGet package is a single ZIP file with .nupkg extension that contains compiled code (DLLs), other files related to that code, and a descriptive manifest that includes information like the package's version number. Developers with a code to share can create packages and publish them to a public or private host. Package consumers obtain those packages from suitable hosts, add them to their projects and call a package's functionality in their project code. Later, NuGet handles all of the intermediate details. The public repository nuget.org contains many such packages. Detailed Steps to Upload Xamarin Android Package to NuGet
-
Register for an account with NuGet.org by logging with your Microsoft credentials
- In your project, go to the lib folder (ie: ~/<Project Location>/lib)
- Create a new lib folder inside (ie: ~/<Project location>/lib/lib)
- Create a file with name <ProjectName>.Xamarin.nuspec file into the first lib folder (ie: ~/<Project Locaiton>/lib/<Project Name>.Xamarin.nuspec)
- Sample Nupsec content below
<?xml version="1.0" encoding="utf.8"?> <package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>SamppleLib.Xamarin</id>
<version>1.0.0</version>
<authors>Karthikeya Koppuravuri</authors>
<owners>Naresh Kumar</owners>
<licenseUrl>https://github.com/sampleApp/blob/master/LICENSE</licenseUrl>
<projectUrl>https://www.Innominds.com/us/developers/SampleLib.html</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Sample Desc</description>
<releaseNotes>https:// github.com/sampleApp/blob/master/README.md</releaseNotes>
<copyright>Copyright © 2018 CA. All rights reserved</copyright>
<tags>SampleApp Innominds Xamarin </tags>
<repository type="git" url="https://github.com/sampleApp/" />
<dependencies>
<dependency id="SampleLib.Xamarin" version="1.0.0" />
</dependencies>
</metadata>
</package> - Change version number string to the required version
- Inside the second lib folder, create two new folders monoandroid and xamarin.ios
- Copy the <ProjectName>.IOS.dll into xamarin.ios folder
- Open a terminal window at the first lib folder location
- Copy the <ProjectName>.Android.dll into the monoandroid folder
- Run the command nuget pack <ProjectName>.Xamarin.nuspec (This will create the nupkg file, which will be uploaded to NuGet)
- Go to https://www.nuget.org/ and login
- At the top of the page, select upload
- Select the nupkg file to upload to NuGet.org
- If you want this to remain invisible, uncheck the box to appear in search. For more details about uploading nuget packages refer to this
- To test install from invisible, navigate to your project and open a terminal window "nuget install <ProjectName>.Xamarin ‐Version 1.0.0" (or whichever the version number is now. This will locally install the package)
- Open your project and add the package from your local
- To test install from visible, in Visual Studio inside your project, add package from Package Manger and search for <PackageName> ‐> Select latest version and add package