SQLite Windows 10 RTM universal app - c#

With the Windows 10 RTM and Visual Studio 2015 RTM SQLite doesn't work any more.
For instance, the tutorial at http://igrali.com/2015/05/01/using-sqlite-in-windows-10-universal-apps/ will not add the SQLLite.cs and SQLiteAsync.cs files to my project, also the "Microsoft Visual C++ Applocal runtime Package for Windows UAP" reference is not available for me.
The funny thing is it worked with the RC versions ...
SQLite Version:
sqlite-uap-3081101.vsix (5.73 MiB)

Using sqlite-uap-3081101.vsix with VS2015 RTM & the 10240 release of the Windows 10 SDK generates the following warnings:
The SDK "SQLite.UAP.2015, Version=3.8.11.1" depends on the following
SDK(s) "Microsoft.VCLibs.AppLocal, version=14.0", which have not been
added to the project or were not found.
This is because the SQLite extension is dependent on the AppLocal Runtime Package. In theory the package would be automatically referenced when adding the extension as a reference, however, the package no longer seems to be included in the referenced release of the W10 SDK.
The AppLocal Runtime Package has been replaced with a CRT package like W8 & W8.1 in the release versions of VS2015 + W10 SDK.
If you add a reference to "Visual C++ 2015 Runtime for Universal Windows Platform Apps" your app will build and run although there'll be warnings until the SQLite extension is updated.
Whilst you can just include SQLLite.cs and SQLiteAsync.cs from SQLite-net directly if you're using nuget to reference a library as per the tutorial then you wont see the files in your project although the classes will be available for you to use.

I think the SQLite team has already fixed the problem.
SQLite for Universal App Platform - See Q and A.
SQLite Timeline
So, just uninstall the existing SDK of SQLite from Visual Studio and install that again. After that I can't see the warning about AppLocal.

Related

How does implicit FSharp.Core reference work in an fsproj?

Months ago I had build a Windows app using a mix of C# and F# projects. The C# project uses FSharp.Core 5.0.0. I had not noticed this until today, but the .fsproj does not specify a version of FSharp.Core. This hasn't been an issue and successfully builds on my local machine using Visual Studio 2019 (all projects are using 5.0.0).
Today, a colleague of mine cloned the repo and tried building the project, only to get a build error for a detected package downgrade of FSharp.Core from 6.0.5 to 5.0.0. My colleague uses Visual Studio 2022 and noticed while the C# project was using FSharp.Core 5.0.0 (as explicitly specified in the .csproj), the F# projects were using 6.0.5.
I've done a bit of reading with what I could find for FSharp.Core implicit references, but don't really understand how the version is selected or how to remedy this situation.
How does Visual Studio figure out which version of FSharp.Core it wants to use for FSharp projects and how can I insure uniform behavior on different machines and versions of Visual Studio.
FSharp.Core is defined in the F# targets loaded by build tooling. It's pinned to the latest released version for the .NET SDK you're using.
You can ready here about using it with C# projects: https://github.com/dotnet/fsharp/blob/main/docs/fsharp-core-notes.md#c-projects-referencing-f-projects-may-need-to-pin-fsharpcore

Nuget Cant install Xamarin.Android.Support.Animated.Vector.Drawable 27.0.2

I am running into an issue when updating installed Nuget packages in my Xamarin.Android project. When running the updates, I get the following error:
Could not install package 'Xamarin.Android.Support.Animated.Vector.Drawable
27.0.2'. You are trying to install this package into a project that targets
'MonoAndroid,Version=v8.0', but the package does not contain any assembly
references or content files that are compatible with that framework. For
more information, contact the package author.
A quick google search yielded several results with similar answers like the one found in this question. It seemed that I simply needed to make sure my Target Framework was set high enough.
Following the instructions found here I set out to change the Target Framework in Visual Studio 2017, however I found that it was already set to use 8.0.
Is there another step that I am missing in order to get these packages to update?
As Jon Douglas mentioned, API 27 actually requires Android 8.1. If you don't have the option to switch to 8.1 you will need to update Visual Studio. Once that is done, you should be able to install the 8.1 SDK via the Android SDK manager (Tools -> Android -> Android SDK Manager).
After the SDK is installed, you can set your Target Framework to 8.1 and update the Nuget packages.
you have to change your Mono.Android.dll Version to 8.1,
When I tried updating this library recently, I found there were some old lingering references in the csproj file, causing conflicts.
To resolve,
Unload the project (right click the project > Unload Project)
Open the csproj (right click the project > Edit xxx.csproj)
Remove all references to 'old' targets (for example, the whole reference tag to old libraries)
There may also be Import tags that need removing
On re-loading the project (right click > Reload Project), I was able to update that library.
In my case, I had Visual Studio 2017 with the most recent SDK version which included Android 8.1.
Even after changing all 3 Android target versions from the project properties to 8.1, the csproj was still showing a TargetFrameworkVersion of 7.1 as follows:
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
I manually changed that to 8.1
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>
It will be interesting to find out if the minimum Android version still needs to be at 8.1 though.
and was then able to update the Nuget packages.

Using C# 7.1 with MSBuild

To use the new C# 7.1 language features with Visual Studio 2017, you add the setting <LangVersion>latest</LangVersion> to your project file(s).
However, building such projects from MSBuild (version 15.3.409.57025, located at C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin) results in an error:
CSC : error CS1617: Invalid option 'latest' for /langversion;
must be ISO-1, ISO-2, Default or an integer in range 1 to 6.
Is this feature just not yet supported by MSBuild, or is it possible to get this working?
This covers 200+ projects that were originally created variously in Visual Studio 2013 and 2015. They were all re-targeted to .NET 4.7 using the Target Framework Migrator tool (which saved lots of clicking and appears - based on inspecting .csproj file changes - to do the job correctly).
The projects all build successfully from Visual Studio 2017.
Nuget packages
Microsoft.Net.Compilers nuget package does not work and needn't to be installed.
Set the following project/build settings
Set at least C# 7.1 or higher in the Debug and Release build properties. (via: Project menu > [ProjectName] Properties > Build tab > [Advanced] button > Language Version).
Setting it to latest does not work.
Also make sure that you are running the latest MSBuild version.
Add a reference to the Microsoft.Net.Compilers package (version 2.3.x, to get C# 7.1).
A short description of the package:
Microsoft.Net.Compilers
This package not only includes the C# and
Visual Basic compilers, it also modifies MSBuild targets so that the
included compiler versions are used rather than any system-installed
versions. Once installed, this package requires Microsoft Build Tools
2015.
Make sure you have changed for "All Configuration" and not just "Debug"
else you will be baffling why it is failing at production.
In case you land here because you get the error as the OP mentioned, running msbuild via command line (e.g. from a build agent such as jenkins), the solution may be as easy as to upgrade Microsoft Build Tools 2015.
You can do that via choco install microsoft-build-tools or manually via the official Microsoft Build Tools 2015 or by updating your Visual Studio 2017 installation.
I've got a solution with a C# console app using C# 7.1 here.
Using the VS 2017 command line (and thus MSBuild 15.3.409.57025) it worked fine. (The .csproj does contain <LangVersion>latest</LangVersion>.)
Is this feature just not yet supported by MSBuild, or is it possible to get this working?
Yes it is.
Which instance of csc.exe is being run and what's its version? Because it looks like, despite quoting the version, you have the wrong version of csc.exe (the error message says 1-6 so not even C# 7 would work).
We discovered that our MVC projects were triggering this issue.
To fix, we updated the Microsoft.CodeDom.Providers.DotNetCompilerPlatform NuGet package used by these projects from version 1.0.0 to 1.0.7.

How do I install SQLite for use in a Universal Windows App targetting UAP v10

I'm trying to get SQLite working in a Universal Windows App targeting UAP v10 using Visual Studio 2015 (RTM).
I've installed the Visual Studio Extension, "SQLite for Universal App Platform" and referenced it (and "Visual C++ 2015 Runtime for Universal Windows Platform Apps") from my project.
I've then added System.Data.SQLite via NuGet, which appears to work as a reference to it gets added to my project and I don't see any error messages. However, I don't appear to get any DLLs added to my project through this process.
Upon further investigation, it looks as though the System.Data.SQLite NuGet package is actually empty, but lists the following as dependencies...
System.Data.SQLite.Core
System.Data.SQLite.Linq
System.Data.SQLite.EF6
So - I tried adding each one of these through the Package Manager Console and received the following error...
Install-Package : System.Data.SQLite.Core 1.0.98.1 is not compatible
with UAP,Version=v10.0.
This seems like a fairly conclusive error message. So what do I do now... is SQLite actually supported for Windows 10 Universal Apps at the moment or not? Documentation I can find on the web seems pretty contradictory or at least seems to imply that I should be able to do what I'm trying to do.
Any help / pointers would be appreciated!
Win10 UWP(UAP) and Win8.1/WP8.1 Store App does not support ADO. System.Data.SQL is an ADO provider, then it's not applicable for UWP, I believe.
To using SQLite on UWP, you need to have SQLite itself and wrapper for .NET.
SQLite - SQLite (Visual Studio Extension)
SQLite wrapper for .NET (NuGet) - SQLite.Net-PCL
or SQLite.Net.Async-PCL
And, following link may helps you. It's a VB guy's blog =) but very insightful for uwp works.
Win10 apps in .NET - references
Edited 7 Feb 2017: Windows 10 Anniversary Update(1607) support the SQLite as "Microsoft.Data.SQLite".
Using SQLite databases in UWP apps - Windows blog
Looks like Microsoft is building a version. As of this comment, they are in release candidate 1.
https://github.com/aspnet/Microsoft.Data.Sqlite
go to http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki and download the right installer for the .net framework youre using.
this will register the dll's for you and give you everything you need
Since the Windows 10 Anniversary Update (Build 14393), SQLite has also shipped as part of the Windows SDK
This link explains everything:
https://blogs.windows.com/buildingapps/2017/02/06/using-sqlite-databases-uwp-apps
SQLite is supported for Universal Windows platform.
C# solution
Install SQLite for Universal Windows Platform Visual Studio extension.
Use SQLite C# API Wrapper Microsoft.Data.SQLite. More information here.
C# or C++/CX solution
Install SQLite for Universal Windows Platform Visual Studio extension.
Add reference to SQLite for Universal Windows Platform extension to your project:
Project => References => Universal Windows => Extensions => SQLite for
Universal Windows Platform
Write your own wrapper using low-level SQLite API in C# or C++.
C++/CX solution
This SQLite-WinRT wrapper is handy for UWP apps written in C++/CX.

Can PCLs created in Visual Studio be used in Xamarin projects?

I created a Portable Class Library the other day in VS2013. It targeted the following platforms:
.NET Framework 4.5
Windows 8.1
Windows Phone 8.1 (non-Silverlight)
My question is, can this be used in Xamarin projects such as Xamarin.iOS or Xamarin.Android? I've found a project claiming to support Xamarin, but grepping the solution and project files for "ios" and "android" turn up nothing. If not, what can I do to make my library portable to those platforms?
Thanks.
You need to install Xamarin for Visual Studio first if you haven't already
Open your PCL project and change the target profile to include the Xamarin platforms you want to support. (e.g. Profile 78)
Optionally retarget all your dependencies (projects/nugets)
Recompile your PCLs
You should now have dlls that work also in Xamarin.
You'll have to make your project target those platforms and then recompile your .dlls in order to make them available for Android and iOS.
I don't know what is the edition of your Visual Studio, but the options to target Android/iOS should be available in VS2013. In any case, try downloading Visual Studio 2015 community (which is free), open your project using it and the option should be there.
If none of this works, you can also try manually changing your .csproj file to a different profile. This is stated to have worked on this answer.

Categories

Resources