How to System.Data.SQLite Interop.dll on Xamarin.Forms? - c#

I get the following problem every time I try to run my mobile application:
System.DllNotFoundException:
'SQLite.Interop.dll assembly:<unknown assembly> type:<unknown type> member:(null)'
To put this in some context:
I am developing on Xamarin.Forms [4.3.0] (in this case running the build on Android 9.0 x86). The client-side library runs on .NET Standard 2.0 and I have installed System.Data.SQLite.Core (1.0.112) from NuGet.
When you look up my problem, you will find people saying to put the SQLite.Interop.dll's into the x86/x64 folders. But when looking for these files there are none for .NET Standard at all, only for .NET Framework. I tried using the SQLite.Interop.dll's from the precompiled statically-linked binaries from the .NET Framework 4.6 version.
Screenshot of the project structure
Same error though.
Unfortunately, it is not possible for me to switch the SQLite library as I am porting a desktop version to mobile which uses this lib.

if they have not made a mess in the classes and functions you need to port you can use "Microsoft.Data.SQLite", there is a difference but is not as far away from usable as the crazy nonsense you need to do with "SQLite-Net-Pcl"

Related

Upgrading from /oldSyntax to /CLR - is .Net 4.0 a minimum requirement?

In preparation for moving to VS2015 I'm upgrading several solutions with CLR projects using the old (now deprecated) "old syntax" to rather use the "new syntax" (i.e. switch /CLR instead of /oldSyntax).
The C# projects are targeting .Net 3.5 (we were hoping to migrate to a later version as a separate step).
I have completed all the syntax stuff (and have no further errors/warnings in that respect), but on building receive the following error:
"SomeAssembly.dll", or one of its dependencies, requires a later version of the .NET Framework than the one specified in the project.
The errors are resolved if I update the C# projects to target .Net 4.0.
Is .Net 4.0 a minimum requirement for using the 'new syntax' (/CLR switch)?
I haven't been able to find any reference material mentioning this.
EDIT: The C# projects are all library projects.
EDIT: Building under VS2008 the error doesn't manifest, but it does when building under VS2015.
I don't find any where that dot net 4.0 is prerequisites for CLR switch, Just check your web.config accordingly before updating the C# projects to target .Net 4.0.

Possible to create an application c# with no framework

for strict constrains in my scenarios, I have very few room to install my application, and .net framework is not installable (any version).
If the application is really simple (more or less), it is possible to create an application in visual studio (in c#) with no dependendency from the .net framework?
Thanks!
Short answer: NO.
There is no way to create a .NET application without any framework.
It is possible to compile a C# app such that it has no dependencies on any of the built-in .NET types & libraries, by using the /nostdlib switch (see http://msdn.microsoft.com/en-us/library/fa13yay7.aspx). You then need to supply your own System namespace.
However, this doesn't remove the need for the .NET framework on the target machine if you use the standard C# compiler. As well as containing the built-in types, the framework also includes the JIT IL compiler, the CLR extra, which all .NET executables and dll's are reliant on.
There are ways of compiling C# code such that it doesn't need the framework though. The Xamarin product for example (http://xamarin.com/), supports compiling C# code to native iOS apps, which are wholely independent of the .NET framework. I'm not aware of any equivalent for "desktop" OS's though.
Writing, compiling and running a C# program without .Net means running a special C# compiler that produces native code instead of managed code. I think such a compiler exists from WinRT for mobile phones, which uses COM instead of .Net (And C++/CX instead of C++/CLI). Code it produces does not depend on the .Net Framework, but does depend on the WinRT runtime.
You may create mono GTK# application and then use mkbundle to generate independent executable. You can use Visual Studio to build your logic and use Xamarin studio to build GTK# GUI. For more information about mkbundle see this and this.
To reply to your query. It really is not possible to create a .Net application without the .Net frame work. And moreover if you have installed Visual Studio by default it would have asked you to install .Net framework or would have installed it by default. In that scenario there is already .Net framework installed in your PC.
Thanks

Create a standalone exe without the need to install .NET framework

I'm a student and at the moment i'm doing an internship at a company. This internship is about analysing a project. For this project I have made a demo to show to the Marketing director. The demo I have made is a simple project created in Visual Studio 2010 in c# with Windows Forms and a connection to an Access database.
So now i have to show this demo to this director in a presentation but after this presentation the director wants the project on his computer so he can try and use it. The problem is now that the computers here in this company don't have .NET framework 4.0 and the computers are so protected over here that we can't install anything new. To install something you have to go through a procedure that takes weeks.
I have looked al over the internet but all i find is how to install the .NET framework.
Is there any possible way that I can create an standalone exe without the need to install .NET framework? Please help!
If you want to execute an application that is developed using Net Framework 4, you will need to have installed .Net Framework 4 on client computer.
Your application is compiled in CIL (Common Intermediate Language), so it needs to be interpreted by the framework engine.
It is the same if you want to execute a Java program. You will have to install the Java Machine.
The only way you don't need to install frameworks is programming native applications with C, C++.
C# now supports this with .NET Native.
Instead of compiling to intermediate language, it will compile to native code and run with statically linked .NET libraries. Therefore, there will be no .Net Runtime requirements for end-users.
https://msdn.microsoft.com/en-us/vstudio/dn642499.aspx
https://msdn.microsoft.com/en-us/library/dn584397(v=vs.110).aspx
Only works for Windows 10
You can't build a C# executable without .NET Framework. Even if some resources indicate that you can, that only works in theory.
But you could use an older version of .NET Framework like .NET 4.0. If this doesn't work for you, you have to choose a language like C++ which doesn't require CLR at all.
Update 2018:
Do not target .NET 2.0 or 3.5. It's not compatible with the 4.x version. However, .NET 4.0 targeted binaries work with .NET Framework 4.0, 4.5, 4.6, 4.7 and so on. So to reach maximum compatibility, compile with .NET 4.0. You will have to accept that some features will not be available, however, your binary will run virtually anywhere.
(2018: By now, .NET 2.0 - 3.5 has much lower distribution than 4.x)
Delphi is your solution, deploy native bin executables
YES, THIS IS POSSIBLE!
At least 3 ways exist:
1.you can check all OSes that you planning to run your app and build with such version of .NET. As Windows have a built-in framework libs.
Vista -.NET v3.0 -- All service packs
Windows 7 - .NET v3.5 -- All versions and service packs
Windows 8 - .NET v4.0 [Best choice if you are not sure]
Windows 8.1 - .Net v4.5
Windows 10 - .Net v4.6
as they are already pre-installed by default -- no extra install will be needed.
2.For windows 10 you can compile it into native code (but not into CIL) with ".NET Native". This is means that there are no .Net Framework will be needed for apps.
3.There is Turbo Studio (earlier Spoon and earlier XenoCode) that can wrap everything that your app needs and runs it in as a standalone.
From their site:
Turbo Studio
Run .NET Without .NET. Easily embed runtime dependencies such as .NET, Java, and SQL directly into virtual applications. Launch reliably on any desktop, regardless of underlying component installs.
You can use Mono and statically link you program, so your program don't need .NET CLR runtime and act as standalone program.
Mono Project
In more modern versions of .NET such as 5 and 6 and even with releases of .NET Core it had become a supported scenario to produce what is referred to as a single-file executable as well as a self-contained application.
As I understand it, these technologies take place of and build upon some of the capabilities that had been in the Mono development stack for a while now. Typically I've seen this feature used for applications which would be deployed to servers such as web sites and microservices however it could be used for scenarios such as the one that the original poster illustrates.
Using the .NET SDK publishing (producing the executable) for a single-file executable can be done using a command as the one below which comes directly from the documentation.
dotnet publish -r win-x64 -p:PublishSingleFile=true --self-contained true
For more details see Single file deployment and executable in the Microsoft .NET documentation site.
To be honest, it really isnt a problem nowadays. the .NET framework is found on almost every single computer nowadays, and you can even make a installer with Advanced Installer that silently install the .NET framework on your computer when you are installing the programme.

Prexisiting dlls (.NET 4 framework) issue with mono for android

I am creating a fresh Mono for android application using http://xamarin.com/monoforandroid
I selected Mono for Android Application using Visual C# option.
My Android target version is :
I went to references of the project and tried adding my pre existing dlls (made in .NET 4 Framework)
and I got this error:
The strange stuff is there is no option to change the .NET Framework from project properties. Can you tell me what I am missing?
The problem here is that you're trying to reference a .NET 4 DLL from a project that isn't .NET 4. Mono for Android uses its own profile for .NET, which is very similar to that of Silverlight (but not exactly the same). While it's possible that adding a DLL compiled for a different profile will work, it's very risky as you will probably run into problems at runtime where your app will crash, due to something being missing from the Mono for Android profile.
The best answer right now is to create a Mono for Android class library, link in the appropriate files from the library you want to use, and reference that. This will give you compile-time checking that you're not using anything unsupported by the Mono for Android profile, and help keep you more sane in the long run. I have an old blog post up here that talks about how to link files across projects.
That said, in this case you're in luck because someone else has already done that last part for you! Check out this fork of Json.NET which provides versions for MonoTouch and Mono for Android.
The strange stuff is there is no option to change the .NET Framework from project properties. Can you tell me what I am missing?
It's not particularly strange - that dialog box was written by Microsoft, with its own project types in mind. It sounds like Mono for Android doesn't have the same options available.
I strongly suspect you'll just have to use a version of JSON.NET targeting .NET 3.5.
(Having said that, Mono for Android claims to support "dynamic language features" which sounds like it should be targeting .NET 4. Odd. I suspect the fix is the same though.)

Using Monotouch with Google .NET APIs

I am using Mike Bluestein's article, http://mikebluestein.wordpress.com/2009/09/27/using-monotouch-with-the-net-library-for-the-google-data-api/, to build an application that communicates with the google APIs.
When I try to add references to my project, the imported projects say "incompatible target framework: v2.0". I can change version to 1.1, 3.0, or 3.5 with the same results.
If I add the .dll to the monotouch project I get a compilation error - monotouch failed with no output 134.
Any suggestions?
http://macpapa.com/macpapa.com/public-images/SM.png
http://macpapa.com/macpapa.com/public-images/PM.png
I don't think regular .NET dlls will work on an iphone - Notice that the article is using source code and project references, not assembly references. Did you follow the instructions on changing the build targets of the google projects?

Categories

Resources