Mobile application development requires a successful installation of the correct development tools & SDKs. In the case of Xamarin, your tools will be Visual Studio 2015 and third-party SDKs. As Visual Studio allows any developer to build any kind of app for any platform, while providing features like IntelliSense, code refactoring, code navigation, debugging & testing in the same IDE, it has a considerable install size. Successful installation of Visual Studio takes time and depends on network connectivity. In this blog, we’ll cover how you can create your own offline installation media for Xamarin with Visual Studio 2015.
Step 0: Whitelist URLs
Before installing Visual Studio, it is important that the following URLs are whitelisted in your firewall/proxy. Failing to do this may result in some components failing to install.
Step 1: Download Setup Files for Offline Installation
ZXing.Net.Mobile is a C#/.NET library based on the open source Barcode Library: ZXing (Zebra Crossing), using the ZXing.Net Port. It works with Xamarin.iOS, Xamarin.Android, Windows Phone (Silverlight) and Windows Universal. The goal of ZXing.Net.Mobile is to make scanning barcodes as effortless and painless as possible in. Installs: 1,000,000+ Download: Android, iOS. Read Also: A Tutorial on Xamarin 2021. Taxfyle is a devoted app made using Xamarin that helps you monitor your taxes on the go. You can now file taxes in real-time and connect in minutes. Users can file both their personal and business tax easily with Taxfyle at fingertips. Release notes detailing API Changes in Xamarin.Forms 126.96.36.1990310 (4.2.0 Service Release 4). Release notes detailing new features, improvements, and issues fixed in Xamarin.Forms 188.8.131.525419 (4.2.0 Service Release 2).
Visit the Visual Studio website, and navigate to the Downloads page. Download the relevant installer for Visual Studio Community, Professional or Enterprise. Once the installer download is complete, run it from the command prompt using the
After executing this command Visual Studio installer will launch and ask you to confirm where to store install items.
Note: The download size will be considerably large and, dependent on your bandwidth, will usually take quite some time to download. Ensure you have enough drive space available. Click on the ‘Download’ button and it will download all the required tools and SDKs to that location:
Step 2: Create Offline Installation Media & Install Visual Studio
Once the download is complete you can copy the contents to a USB drive or use any ISO creation tool to create your offline installation media. This will help to mount the ISO as and when required and run the setup by executing the installer. Start the Visual Studio installation from your new installation media and sit back until it completes.
Step 3: Check for Android Updates
Optionally, when the installation is complete, you can check for any Android SDK Updates. This can be done by launching Android SDK Manager from Visual Studio > Tools > Android > Android SDK Manager.
If there are any updates, select and install them.
Step 4: Verify Installation
At this point, you will be able to build Android and iOS applications using Visual Studio 2015. To verify that the install was successful you can create a new blank Android or iOS project with default the configuration and run it. The project should build and run on device or emulators without any issues.
Step 5: Resolving Errors when Building Xamarin.Forms Applications
When a Xamarin.Forms project is compiled for the first time (or when related NuGet packages are updated and a project is compiled) Visual Studio downloads associated Android Support Library packages. Visual Studio will not indicate the size or download progress for installing these packages. If these packages are corrupt because of an incomplete download then there will be errors during compilation:
If this happens then our guide on Resolving Library Installation Errors will help you resolve any issues.
Bonus Tip 1:
If code is downloaded from the internet or GitHub as zip file then it’s possible that the zip file is blocked from being extractable in Windows. If the zip was extracted and the solution is opened in Visual Studio then the build may fail. To avoid this you can unblock the zip files which were downloaded before extracting and opening the solution in Visual Studio. To do so you can right the zip and go to ‘Properties’. You will see an ‘Unblock’ checkbox toward the bottom of the dialogue:
Bonus Tip 2:
Depending on the Android API installed during installation the projects might either be targeting Android N (API 24) or Android M (API 23). By default, during the installation, Visual Studio installs JDK1.7. However, if the project is targeting API 24 then JDK1.8 is required. In case the project targeting API 24 is compiled with JDK1.7 and you will see an error like this:C:Program Files (x86)MSBuildXamarinAndroidXamarin.Android.Common.targets(3,3): Error: java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
The Version 52.0 here is referring to the specific release of the JDK which in this case relates to JDK 8. Xamarin.Android 7.0 requires JDK 1.8 to use the Android Nougat (API 24) APIs. You can continue to use earlier versions of the JDK if targeting earlier Android API levels:
- JDK 1.8– up to API 24+
- JDK 1.7– up to API 23
- JDK 1.6– up to API 20
Additionally, a 64-bit version of the JDK is required to use custom controls in the Android designer.
The best option is to install the 64-bit version of JDK 1.8 since it is backward compatible with all the previous API levels and supports the new Android designer features.
More information on this can be found in our Android 7.0 Release Notes.
Today we’re excited to announce the release of TypeScript 4.2!
To get started using TypeScript 4.2, you can get it through NuGet, or use npm with the following command:
You can also get editor support by
- Installing the Insiders Version of Visual Studio Code or following directions to use a newer version of TypeScript
- Sublime Text 3 via Package Control.
Let’s take a look at what’s in store for TypeScript 4.2!
Smarter Type Alias Preservation
TypeScript has a way to declare new names for types called type aliases. If you’re writing a set of functions that all work on
string number boolean, you can write a type alias to avoid repeating yourself over and over again.
TypeScript has always used a set of rules and guesses for when to reuse type aliases when printing out types. For example, take the following code snippet.
If we hover our mouse over
x in an editor like Visual Studio, Visual Studio Code, or the TypeScript Playground, we’ll get a quick info panel that shows the type
BasicPrimitive. Likewise, if we get the declaration file output (
.d.ts output) for this file, TypeScript will say that
However, what happens if we return a
We can see what happens in the TypeScript playground. While we might want TypeScript to display the return type of
BasicPrimitive undefined, it instead displays
string number boolean undefined! What gives?
Well this has to do with how TypeScript represents types internally. When creating a union type out of one or more union types, it will always normalize those types into a new flattened union type – but doing that loses information. The type-checker would have to find every combination of types from
string number boolean undefined to see what type aliases could have been used, and even then, there might be multiple type aliases to
string number boolean.
In TypeScript 4.2, our internals are a little smarter. We keep track of how types were constructed by keeping around parts of how they were originally written and constructed over time. We also keep track of, and differentiate, type aliases to instances of other aliases!
Being able to print back the types based on how you used them in your code means that as a TypeScript user, you can avoid some unfortunately humongous types getting displayed, and that often translates to getting better
.d.ts file output, error messages, and in-editor type displays in quick info and signature help. This can help TypeScript feel a little bit more approachable for newcomers.
For more information, check out the first pull request that improves various cases around preserving union type aliases, along with a second pull request that preserves indirect aliases.
Leading/Middle Rest Elements in Tuple Types
In TypeScript, tuple types are meant to model arrays with specific lengths and element types.
In TypeScript 4.2, rest elements specifically been expanded in how they can be used. In prior versions, TypeScript only allowed
...rest elements at the very last position of a tuple type.
However, now rest elements can occur anywhere within a tuple – with only a few restrictions.
The only restriction is that a rest element can be placed anywhere in a tuple, so long as it’s not followed by another optional element or rest element. In other words, only one rest element per tuple, and no optional elements after rest elements.
These non-trailing rest elements can be used to model functions that take any number of leading arguments, followed by a few fixed ones.
doStuff as a function that takes leading arguments by declaring the
For more details, see the original pull request.
Stricter Checks For The
in operator. TypeScript 4.2 ensures this can be caught at design-time.
This check is fairly conservative for the most part, so if you have received an error about this, it is likely an issue in the code.
A big thanks to our external contributor Jonas Hübotter for their pull request!
Back when TypeScript first introduced index signatures, you could only get properties declared by them with “bracketed” element access syntax like
This ended up being cumbersome in situations where we need to work with objects that have arbitrary properties. For example, imagine an API where it’s common to misspell a property name by adding an extra
s character at the end.
To make these types of situations easier, a while back, TypeScript made it possible to use “dotted” property access syntax like
However, loosening the restriction also meant that misspelling an explicitly declared property became much easier.
In some cases, users would prefer to explicitly opt into the index signature – they would prefer to get an error message when a dotted property access doesn’t correspond to a specific property declaration.
That’s why TypeScript introduces a new flag called
--noPropertyAccessFromIndexSignature. Under this mode, you’ll be opted in to TypeScript’s older behavior that issues an error. This new setting is not under the
strict family of flags, since we believe users will find it more useful on certain codebases than others.
You can understand this feature in more detail by reading up on the corresponding pull request. We’d also like to extend a big thanks to Wenlu Wang who sent us this pull request!
abstract Construct Signatures
TypeScript allows us to mark a class as abstract. This tells TypeScript that the class is only meant to be extended from, and that certain members need to be filled in by any subclass to actually create an instance.
To make sure this restriction in
abstract classes is consistently applied, you can’t assign an
abstract class to anything that expects a construct signature.
This does the right thing in case we intend to run code like
new Ctor, but it’s overly-restrictive in case we want to write a subclass of
It also doesn’t work well with built-in helper types like
That’s why TypeScript 4.2 allows you to specify an
abstract modifier on constructor signatures.
abstract modifier to a construct signature signals that you can pass in
abstract constructors. It doesn’t stop you from passing in other classes/constructor functions that are “concrete” – it really just signals that there’s no intent to run the constructor directly, so it’s safe to pass in either class type.
This feature allows us to write mixin factories in a way that supports abstract classes. For example, in the following code snippet, we’re able to use the mixin function
withStyles with the
withStyles is demonstrating a specific rule, where a class (like
StyledClass) that extends a value that’s generic and bounded by an abstract constructor (like
Ctor) has to also be declared
abstract. This is because there’s no way to know if a class with more abstract members was passed in, and so it’s impossible to know whether the subclass implements all the abstract members.
You can read up more on abstract construct signatures on its pull request.
Understanding Your Project Structure With
A surprisingly common scenario for TypeScript users is to ask “why is TypeScript including this file?”. Inferring the files of your program turns out to be a complicated process, and so there are lots of reasons why a specific combination of
lib.d.ts got used, why certain files in
node_modules are getting included, and why certain files are being included even though we thought specifying
exclude would keep them out.
That’s why TypeScript now provides an
When using this option, the TypeScript compiler will give some very verbose output about why a file ended up in your program. To read it more easily, you can forward the output to a file, or pipe it to a program that can easily view it.
Typically, the output will start out by listing out reasons for including
lib.d.ts files, then for local files, and then
Right now, we make no guarantees about the output format – it might change over time. On that note, we’re interested in improving this format if you have any suggestions!
For more information, check out the original pull request!
Improved Uncalled Function Checks in Logical Expressions
Thanks to further improvements from Alex Tarasyuk, TypeScript’s uncalled function checks now apply within
--strictNullChecks, the following code will now error.
For more details, check out the pull request here.
Destructured Variables Can Be Explicitly Marked as Unused
Thanks to another pull request from Alex Tarasyuk, you can now mark destructured variables as unused by prefixing them with an underscore (the
_first was never used later on, TypeScript would issue an error under
noUnusedLocals. Now, TypeScript will recognize that
_first was intentionally named with an underscore because there was no intent to use it.
For more details, take a look at the full change.
Relaxed Rules Between Optional Properties and String Index Signatures
String index signatures are a way of typing dictionary-like objects, where you want to allow access with arbitrary keys:
Of course, for any movie title not yet in the dictionary,
movieWatchCount[title] will be
undefined (TypeScript 4.1 added the option
--noUncheckedIndexedAccess to include
undefined when reading from an index signature like this). Even though it’s clear that there must be some strings not present in
movieWatchCount, previous versions of TypeScript treated optional object properties as unassignable to otherwise compatible index signatures, due to the presence of
TypeScript 4.2 allows this assignment. However, it does not allow the assignment of non-optional properties with
undefined in their types, nor does it allow writing
undefined to a specific key:
The new rule also does not apply to number index signatures, since they are assumed to be array-like and dense:
You can get a better sense of this change by reading up on the original PR.
Declare Missing Helper Function
Thanks to a community pull request from Alexander Tarasyuk, we now have a quick fix for declaring new functions and methods based on the call-site!
We always strive to minimize breaking changes in a release. TypeScript 4.2 contains some breaking changes, but we believe they should be manageable in an upgrade.
Download Xamarin Android Emulator
As with every TypeScript version, declarations for
lib.d.ts (especially the declarations generated for web contexts), have changed. There are various changes, though
ResizeObserver‘s may end up being the most disruptive.
noImplicitAny Errors Apply to Loose
When the value of a
yield expression is captured, but TypeScript can’t immediately figure out what type you intend for it to receive (i.e. the
yield expression isn’t contextually typed), TypeScript will now issue an implicit
See more details in the corresponding changes.
Expanded Uncalled Function Checks
As described above, uncalled function checks will now operate consistently within
expressions when using
--strictNullChecks. This can be a source of new breaks, but is typically an indication of a logic error in existing code.
in Operator No Longer Allows Primitive Types on the Right Side
As mentioned, it is an error to use a primitive on the right side of an
in operator, and TypeScript 4.2 is stricter about this sort of code.
See the pull request for more details on what’s checked.
Tuple size limits for spreads
Tuple types can be made by using any sort of spread syntax (
...) in TypeScript.
Sometimes these tuple types can accidentally grow to be huge, and that can make type-checking take a long time. Instead of letting the type-checking process hang (which is especially bad in editor scenarios), TypeScript has a limiter in place to avoid doing all that work.
You can see this pull request for more details.
.d.ts Extensions Cannot Be Used In Import Paths
In TypeScript 4.2, it is now an error for your import paths to contain
.d.ts in the extension.
Instead, your import paths should reflect whatever your loader will do at runtime. Any of the following imports might be usable instead.
Reverting Template Literal Inference
This change removed a feature from TypeScript 4.2 beta. If you haven’t yet upgraded past our last stable release, you won’t be affected, but you may still be interested in the change.
The beta version of TypeScript 4.2 included a change in inference to template strings. In this change, template string literals would either be given template string types or simplify to multiple string literal types. These types would then widen to
string when assigning to mutable variables.
Download Xamarin Studio
This is similar to how string literal inference works.
For that reason, we believed that making template string expressions have template string types would be “consistent”; however, from what we’ve seen and heard, that isn’t always desirable.
In response, we’ve reverted this feature (and potential breaking change). If you do want a template string expression to be given a literal-like type, you can always add
as const to the end of it.
lift Callback in
visitNode Uses a Different Type
TypeScript has a
visitNode function that takes a
lift now expects a
readonly Node instead of a
NodeArray<Node>. This is technically an API breaking change which you can read more on here.
While 4.2 was just released, our team is already hard at work on TypeScript 4.3. You can take a look at the TypeScript 4.3 iteration plan and our rolling feature roadmap to keep track of what we’re working on.
You can also stay on the bleeding edge with TypeScript nightly releases too, and with our nightly Visual Studio Code extension. Nightly releases tend to be fairly stable, and early feedback is encouraged and appreciated!
But we expect most users will stick with TypeScript 4.2 for now; and so if you are using TypeScript 4.2, we hope this release is easy to adopt and makes you a lot more productive. If not, we want to hear about it! We want to make sure that TypeScript brings you joy in your coding, and we hope we’ve done exactly that.
– Daniel Rosenwasser and the TypeScript Team