sqlite.cs could not find sqlite3 and community - sqlite

I am developing WP8 app on VS 2012 Express. Installed SQLite for Windows Phone and Sqlite-net.
And imported SQLite for Windows Phone as references.
However when I was trying to build the project it says:
Error 1 The type or namespace name 'Community' could not be found (are you missing a using directive or an assembly reference?)
And
Error 4 The type or namespace name 'Sqlite3' could not be found (are you missing a using directive or an assembly reference?)
What did I miss?

I think you forgot to add USE_WP8_NATIVE_SQLITE to your conditional compilation symbol.
#if USE_CSHARP_SQLITE
using Sqlite3 = Community.CsharpSqlite.Sqlite3;
using Sqlite3DatabaseHandle = Community.CsharpSqlite.Sqlite3.sqlite3;
using Sqlite3Statement = Community.CsharpSqlite.Sqlite3.Vdbe;
#elif USE_WP8_NATIVE_SQLITE
using Sqlite3 = Sqlite.Sqlite3;
using Sqlite3DatabaseHandle = Sqlite.Database;
using Sqlite3Statement = Sqlite.Statement;

I tested it, seems to be a bit problem with Windows phone 8 and Sqlite.
First thing to solve your problem is, to add the "Community.Csharpsqlite.WP" reference to the app. To do this, open the Nuget package manager and type "csharpsqlite" and install the resultant nuget package in your app. This resolves both the above issues you mentioned in your question. but agian, raises another problem. There are some incompatible methods in between "Community.Csharpsqlite.WP" and SQLite.cs file from "sqlite-net". One solution for this is to manually modify the methods in SQLite.cs to resolve the incompatibilities.
Alternatively, if the above process doesn't work out for you, then use the process of WP7 sqlite as mentioned in the dotnetslackers link. Test this in a separate project and hopefully this should work.

I got it working on Windows Phone 8 without csharpsqlite.
Peterhuene created a wrapper for SQLite which you can get from GitHub. No csharpsqlite needed anymore. The readme section contains all information needed.
A detailed description of how to set it up can also be found here on CodeProject.

I'm assuming you followed the instruction in this post
In the post there is an instruction that you add a c++ project to your solution named Sqlite. You get it from github. Admittedly this is very well hidden within the post and is easy to miss.
After including the c++ project to your solution you should add a reference to it from your C# project.
Add reference -> solution -> choose the c++ "Sqlite" project As a reference
After that, and adding the build constant USE_WP8_NATIVE_SQLITE it should work.

In SQLite.cs, there are several places you will see such lines
#if USE_CSHARP_SQLITE
...
...
#elif USE_WP8_NATIVE_SQLITE
...
...
Just replace the codes inside #if USE_CSHARP_SQLITE with the codes inside #elif USE_WP8_NATIVE_SQLITE and you are good to go.
Or there is also a short method. Go to properties->build and after ; add "USE_WP8_NATIVE_SQLITE" and rebuild the solution. This worked for me

Related

The type or namespace name 'ApiVersionDescription' could not be found (are you missing a using directive or an assembly reference?)

I already added the package of Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer, but I'm still getting this error. Is anyone have an idea on how to resolve this issue?Thank you in advance.
Reference: https://www.meziantou.net/versioning-an-asp-net-core-api.htm#integration-with-ope
You haven't said which versions or runtimes you are targeting. I'm going to assume that your project is .NET Core 3.1 or newer and the language is C#. The ApiVersionDesription class is defined in Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.dll. The following are required to resolve this error message:
Reference the Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer NuGet package
Use the corresponding namespace with using Microsoft.AspNetCore.Mvc.ApiExplorer;
You said you've already done #1 so I presume the only issue is #2. If you did not add the reference using tooling, it's worth double-checking that the NuGet package is properly referenced and the containing assembly was also added as a reference.
You also did not mention what your end goal was. 99% of the scenarios that use the API Explorer extensions for API Versioning want to wire up Swashbuckle or some other Open API/Swagger document generator. I would consider reviewing the official API Versioning Swagger Example for ASP.NET Core and cross-reference it with your configuration. It is a working end-to-end solution and should help reveal the step or steps that you're missing.

How can I fix the error on Newtonsoft.Json using statement?

I am working on a .Net console app with c# and I have just added the Newtonsoft.Json using statement but VS code points it out as an error
The type or namespace name 'Newtonsoft' could not be found (are you
missing a using directive or an assembly reference?)
and suggests I remove unnecessary using statements but it's not unnecessary since I need it for serialization.
Is this a general problem or am I doing something wrong?
An Image showing the error prompt
You are getting the exception because the compiler could not find the Newtonsoft library. You will need to make sure you have installed it and added it as reference. You can do this through NuGET or add the library manually as a refrence.

SQLiteConnection is not defined

I am trying to add SQL lite to a phone project. I am following the Peter Huene project and SQLite-net-wp8 - https://github.com/peterhuene/sqlite-net - But I keep getting the error SQLiteConnection not defined. (I did set references and Nuget packages.)
The part I skipped is the conditional compilation symbols change he mentions (add USE_WP8_NATIVE_SQLITE) - My property page does not show a build tab - I have looked all over for the place to make that change but can't find it. Any thoughts?
Here is what my structure looks like (basically):
-Windows8PhoneMainProject
-SQLiteProject
SQLite.cs and SQLiteAsync.cs files are under SQLiteproject (not sure where I should place them - it seems to make no difference)
What am I missing? I find not Build tab or Conditional Compilation Symbols setting.
I found the answer - thought I would share it. It was because I was using VB instead of C# - had to add a C# project. (see below)
To use SQLite for wp8 with VB you are going to need 3 projects. The c++ SQLiteProject, the windows phone 8 VB project, and a C# windows phone 8 class library. Add the SQLite.cs and SqliteAsync.cs to the c# class library and add a reference to the c# dll in the VB project
Answered by MS forum:
http://social.msdn.microsoft.com/Forums/wpapps/en-US/46ff757a-3951-45fc-a267-2a221cd45006/sqlite-and-vb-cannot-see-sqliteconnection?forum=wptools

SQLite Client could not be found on release configuration

I'm preparing to submit by app to marketplace and I wanted to run 'Marketplace Test Kit'. I've read some articles and as it was there I changed active config to Release|Any CPU.
When I want to rebuild I get couple of problems with references connected with SQLClient which I use in my app. Normally everything is working well. Just when I switch from debug to release they appears:
The type or namespace name 'SQLiteClient' could not be found (are you missing a using directive or an assembly reference?)
And I places when he shows I have defined them like that:
using SQLiteClient;
Reference is added as Community.Csharp.Sqlite.WP
Oh, poor me ;)
I just deleted/added again the dll and that worked!
Showing error in release mode
Topic above with similar problem

Using nAnt to build projects containing EDMX

I've been working on training myself in the ways of using nAnt over the past few days, and have stumbled across an issue. During the development process, I've been using the new tools, like Entity Data Model, for database access.
When you go to try to build a library/executable that contains the Edmx product, you cannot embed the required files from visual studio. Now, I realize that I can do an exec task inside of nAnt and call msbuild for the particular project file, but I am trying to keep this to be completely nAnt build for now, so I'm in a heavy struggle to get things to work.
I did some searching to find a way ot handle this, and came across this Inline C# class that is supposed to do the trick. My problem is that I do not see how you call this in the target stack in order to get it to do its job. Can anyone shed some light on this? It would be of some great help.
Ok... so I'm a bit further along with this. I have since found that the code the gentleman has posted needs to be under the task for which it is meant to be run for. I'm even getting the *.ssdl, *.csdl, and *.msl files rendering into the directory... cool beans.
nwo i'm getting something interesting coming through... I've got reference via a "references" tag to System.Data.Entity, but I keep getting the following compile error:
error CS0234: The type or namespace name 'Objects' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
Any suggestions?
OK!!!
Got it! I had to edit the NAnt.exe.config file and add the System.Data.Entity.dll file into the Framework element for the .net framework 3.5!!!
I may wind up building a 3.5 SP1 entry, and if someone can give me a good area to post it, I'd be good to go.

Resources