.NET Framework Dependency appxmanifest - desktop-bridge

I am in process of prepping my Windows Desktop app for upload to the MS Store. I have a (fully functional) MSI installer for my app and attempted to use the Desktop App Converter (DAC) but experienced an error and have not gotten past it yet. So I decided to give manual package (appx) creation a try and it went well since I was able to install my app using the package I created. But I have a question about how to handle my .NET Framework dependency in the package. My MSI Installer has the '.NET Framework version 4.7.1' as a prerequisite so that it gets downloaded and installed (from MS, if not already installed). My question is how to handle the prerequisite in my package. I'm assuming it would go in the AppxManifest.xml under Dependencies where I currently have (note I removed the brackets so my code would display here)...
Dependencies
TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14316.0" MaxVersionTested="10.0.16299.309" /
/Dependencies
...but I am unsure of the syntax to add .NET Framework 4.7.1 so that it gets properly installed (if not already there) on target systems for my app.
Thanks!

If the app has 4.7.1 as a prerequisite, they will need to set their minversion to 16299 (Fall Creators Update).
In general, you cannot redist .NET with your app package, as it comes with the OS. But if you require a specific version, you need to make sure the minversion matches the update of Win10 that includes that specific version. You could use this table to look it up: .NET Framework Versions and Dependencies.

Related

Xamarin with Entity Framework Core: Error: unauthorized access to "/system/lib/libsqlite.so" on Android 7

Im trying to create a Xamarin Forms App using the new Entity Framework Core. The app targets android 6.0 but my Emulator is running Android 7.0. I installed the following related Nuget packages on the android project:
Microsoft.EntityFrameworkCore --> 1.1.1
Microsoft.EntityFrameworkCore.Sqlite --> 1.1.1
When accessing my DbContext on Android a message will pop up telling: Detected problems with native libraries unauthorized access to "/system/lib/libsqlite.so".
This Xamarin forums thread suggests, that it's due to the native SqLite binaries are no longer supported (on Android 7?) and the common fix seems to be to switch to the SqLite.Net PCL.
However as Microsoft.EntityFrameworkCore.Sqlite depends on Microsoft.Data.Sqlite which in turn depends on the native SqLite package I cannot just replace this (or can I?)
Strangely enough, despite of the error message suggesting otherwise, the data access seems to work. At least migrations run and repeated writes to the database will create new Ids.
Of course I could just scrap EF Core but I guess a lot of people are looking into using it for Xamarin in the future. So it would be nice if anyone would find/know a fix.
I had the same problem. I have fixed this using the following libs: sqlite-net-pcl (version 1.2.0), SQLitePCLRaw.bundle_green, SQLitePCLRaw.core, SQLitePCLRaw.lib.e_sqlite3.android, SQLitePCLRaw.provider.e_sqlite3.android.
Matheus Souza had the right idea there. However installing SQLitePCL is only part of the answer. Here is how I eventually solved this:
DISCLAIMER: This is a kind of "You can do it but it isn't pretty"-solution. If you have the time, it's probably best to wait for the official Microsoft.EntityFrameworkCore.Sqlite 1.2.0 release.
This issue brought me on the right track. The new (unreleased) version of EntityFrameworkCore no longer uses the native sqlite binaries, but sqlite-net-pcl. This is the steps I followed to install it:
Add the aspnetcore-dev branch to your nuget feeds. Nuget 3: https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json
Check "Show preview versions" in Nuget and update (or reinstall) all EntityFrameworkCore packages to "1.2.0 - preview"
(Make sure your x64 is checked in your android projects advanced build options, if the app instantly crashes on deploy. This might be unreleated)

Xamarin SQLite "This is the 'bait'"

I follow this guide trying to create a SQLite database to my proyect. But always got same error, doing the exactly steps of the article.
System.Exception: This is the 'bait'. You probably need to add one of the SQLitePCLRaw.bundle_* nuget packages to your platform project.
Have you added the SQLite package to all your projects? You need to add it to the app projects as well as the PCLs.
This is what the error is telling you. It uses a trick called 'bait and switch' whereby it installs a dummy assembly in the PCL with a particular interface, and in the Android and iOS apps it installs a platform specific assembly with an identical interface that actually does the interactions with the database. The idea is you code against the PCL, but at run time the platform specific version of the library is used. You can read more about this pattern at https://web.archive.org/web/20161209075521/http://log.paulbetts.org/the-bait-and-switch-pcl-trick/
Essentially though, this error is telling you that you haven't installed the NuGet package in your platform-specific projects.
I was experiencing this issue despite following the instructions in the error message and installing the missing library.
A clean & rebuild solved it
I had installed the packages (SQLite-net PCL) but I uninstalled them, then reinstalled. And then I cleaned the solution and rebuilded it and now it works.

Realm support for Swift 3

So I updated to swift 3.0 and now my projects with realm 1.0.2 all give me an error.
RealmSwift compiled with older version of Swift language (2.0) than previous files (3.0)
I also tried to build a net new project and still get the build error, so I know it is not a conversion issue on the Swift side.
I found several Swift 3.0 beta users and tried to run the script to update my version to 3.0 and several other options. The last few posts appeared to use Cocoa Pods - which I don't currently use. Is that the supported fix path?
Any help or direction would be greatly appreciated.
I haven't tried it yet, but here is what should work.
Essentially, the compiler gives you a description of what went wrong. The framework was compiled with Swift 2.0, while your project or other files were compiled with Swift version 3.0 (which means you made the switch after upgrading to the new version of Xcode.
To fix this, you need to use the Realm framework compiled with a Swift 3.0 compiler. Since the Realm team doesn't yet provide a precompiled version compiled with Swift 3.0, you have to do so yourself. To do that, go to their Github repository, and follow the instructions in the README under "Building Realm":
Prerequisites:
Building Realm requires Xcode 7.3.
Building Realm documentation requires jazzy
Once you have all the necessary prerequisites, building
Realm.framework just takes a single command: sh build.sh build.
You'll need an internet connection the first time you build Realm to
download the core binary.
This should generate the Realm framework with the current compiler version, which you then just have to use to replace your current Realm framework with. After that, everything should compile as it used to.
As stated before, I don't know if this actually works, as I haven't tried it yet. I don't exactly know if Swift 3.0 is supported by Realm yet or if there are any other issues you could run into. So please let me know how this works out!

Xamarin.Forms version

When I create a new Xamarin.Forms project within Visual Studio it uses an old version of the Xamarin.Forms DLL (v2.0.0.6482). In nuget theres an update available to v2.3.0.107.
Why is an old version being used on project creation?
Im on the latest Visual Studio 2015 update and Xamarin version.
Thanks in advance
This is expected since the Forms templates that ship with Xamarin for Visual Studio are not updated as frequently as the package itself. You can go ahead and update the packages to the latest version available on NuGet. Just make sure to update the Forms package in all the projects to the same version.
Note though, only update the Forms package inside the Android project and not the Android Support packages. Forms will also update those to the correct versions needed in order to avoid compatibility issues.
Ok, sounds like it is an issue for a few people.
I have gotten it working with the help of a friend!
It's working fine for me now; I followed the steps below:
Start a new Xamarin.Forms portable project
Uninstall all Xamarin nugets, clear the packages folder (others will be downloaded)
Close VS 2015
Clear the C:\Users_[Username]_\AppData\Local\Xamarin\zips folder, these will be downloaded automatically as needed.
Open the project
Update nugets then install Xamarin.Forms 2.0.0.6490, this should get the relevant version of dependencies for the android project (ie Xamarin.Android.Support.x). This will be v23.0.1.3, even though an update exists, as MatPag stated, it is not yet compatible.
Build.
This will take a long, long time, as the Xamarin\zips folder will be re-populated so a quite hefty file will be downloaded.
Might complain again, clean, save then reopen.
This is will definitely work fine

Can't create new projects in VS2013 -- most references are missing

About a week ago I noticed strange behavior with my install of Visual Studio 2013 Pro. Creating new projects always results in missing references to EntityFramework and most of the Microsoft.* components. I had reinstalled .NET 4.5 in repair mode around that time but can't recall if this problem happened before or after that install.
As it stands, I can no longer create a functioning project. I have an existing project I'm working on that will compile and run without issue, but creating any new projects (which I need for spike solutions etc) is no longer possible until this is fixed.
Screenshots follow. These are all from creating a new MVC project with all defaults accepted.
References list showing missing references
Error list upon building
Reference paths are empty (this was mentioned in another answer that did not directly address my specific question, so I'm including it)
Regedit showing .NET versions installed
Even though I have "repaired" .NET 4.5 it appears from regedit that I only have up to .NET 4 installed? Am I reading that correctly?
Also, due to network restrictions I cannot download packages from Nuget automatically -- I have to download them manually from a laptop off-network and then sneakernet them over to install. The network physically blocks all connections to Nuget, github, etc.
If allowing VS to connect to Nuget is the only viable option then I have considered installing VS on the laptop, creating the project there and installing all necessary dependencies, and then moving the project folder over to the restricted computer and continuing from there. But I don't know if that is a solution to this problem or not.
Any advice appreciated, thanks.
.
The network blocks all connections to Nuget, github, etc.
It's almost like they don't want you to be productive.
Anyway the project templates (which you seem to be talking about) reference specific NuGet packages. Packages by default are stored relative to your solution.
Place a nuget.config in your disk's root (or any point into your projects directory, if you keep them organized like C:\Dev\Visual Studio\Projects, then each of those subfolders will be file) and point in that file to a shared package directory on your development machine. Here you can dump all packages you require.

Resources