System.Data.SQLite.dll isn't found trying to add a reference - c#

(Beginner level)
I have a DB in SQLite3.
I would like to populate a DataGridView by data from the DB.
Currently I'm at the first phase to create a connection/using.
Also, when I add this: using System.Data.SQLite; I get an error:
Error CS0234 The type or namespace name 'SQLite' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
In this tutorial it guides to add System.Data.SQLite.dll as reference - in folder Program Files (x86) should appear System.Data.Sqlite, but the folder does not exist. The dll file cannot be found, I searched for it also in the Reference Manager Browse.
(Thanks in advance)

First Add With Nuget Syste.Data.SqLite.
or run the command in the Package Manager Console
Install-Package System.Data.SQLite
Then right click on your project references, an select add reference.
Select Under Assemblies, Framework.
Then left click on System.Data.SQLite.
This will add Mono.Data.SqLite to your reference.
So type in your code
using Mono.Data.Sqlite;
This reference is of the same use case as System.Data.SQLite.

You can add the assembly with NuGet. Install System.Data.SQLite.
To install System.Data.SQLite (x86/x64), run the following command in the Package Manager Console
Install-Package System.Data.SQLite

Related

How can i solve a Dotnet build Error "namespace name 'Azure' could not be found"?

I am running a simple .NET application that connects to Azure Event Hubs and send sample data.
Unfortunately when i hit " dotnet run" i get the following errors:
C:\Users\[...]\EventHubSampleSendData\Program.cs(1,7): error CS0246: The type or namespace name 'Azure' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\[...]\SendSampleData.csproj]
It looks like dotnet cannot recognize the Azure library "(using) Azure.Messaging.EventHubs) inside the Program.cs
I tried the command "dotnet add package Azure.Messaging.EventHubs" but it gives also errors ( The project does not support adding package references through the add package command.)
project:
https://github.com/Azure-Samples/event-hubs-dotnet-ingest/tree/master/EventHubSampleData/EventHubSampleSendData
The solution is to re-intsall or restore all the packages that you have installed while creating your project. The way to do it is:
restore the dotnet packages, run dotnet restore in your src directory. If that doesn't solve the issue check if the specified package is added otherwise you can add it through nuget.

The type or namespace name "HTTP" doesn't exist in the namespace system.web error in .net 4.6.2

I am new to .net/C#. I am trying to build a project but getting a lot of missing reference error.
When I am trying to install the packages like mentioned in example, I am getting error that it already exists in the project.
PM> Install-Package Microsoft.AspNet.WebApi.Core
Package 'Microsoft.AspNet.WebApi.Core.5.2.7' already exists in project 'XXXXXXystemApi'
Time Elapsed: 00:00:16.0349189
Also, as in below screenshot, I see that there are few references which have a little warning signs which might be pointing towards what is wrong with my setup.
The type or namespace name 'Http' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)
I tried to Add references to the project but I am not seeing any entry for System.Web.Http under add reference dialog.
How do I fix all this ?
Try running
dotnet restore
in the Package Manager Console
Also, unloading and reloading the project has worked for me before
(Right-click on the project name in the Solution explorer to unload and reload)
Here is what finally solved my problem.
use NuGet and downgrade a version of library you are having issue with ; then re-install the right version. Accept Licenses (which is probably what was needed). Important: close and reopen visual studio.
Reference link : solution ref

SQL Server with Unity3D

I want to use SQL Server with Unity. I add System.Data.dll to assets in Unity project but I get this error:
The type or namespace name 'SqlClient' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
Then I added sqlclient.dll to the assets folder, but I still get:
The type name 'SqlConnection' could not be found in the namespace 'System.Data.SqlClient'. This type has been forwarded to assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
Consider adding a reference to that assembly.
Please help me! What's wrong?
After some researches, looks like there are much easy way to import sql in new versions of Unity:
Download new System.Data.SqlClient from nuget. For example, use in
terminal nuget install System.Data.SqlClient -Version 4.7.0
-OutputDirectory <some temp dir>
Open unity build settings, find Api Compatibility Level. It will be .NET 4.x or .NET Standard 2.0
Create Plugins directory in folder
Copy dll from <some temp dir>/lib/<api level>/System.Data.SqlClient.dll to Plugins directory.
That all, you can use sql :)
For example, in my case there are .NET Standard 2.0 compat. level and <some temp dir>/lib/netstandard2.0/System.Data.SqlClient.dll library.

The type or namespace name 'OpenIdConnect' does not exist in the namespace 'Microsoft.Owin.Security' (are you missing an assembly reference?)

I have added a Microsoft.Owin.Security.OpenIdConnect.dll externally(tried both methods using Package Manager Console and using add reference ) to my ASP.NET MVC Application, but still get the same error.
The type or namespace name 'OpenIdConnect' does not exist in the namespace 'Microsoft.Owin.Security' (are you missing an assembly reference?)
I have attached AccountController.cs, packages.config and references
Any help.
You can try with deleting Package folder from source directory (Location: .sln file), then try to resotre packages.
Steps to restore nuget packages:
Right click on solution file.
Select Nuget restore NuGet Package option
I found the solution from Microsoft site
https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2012/0e92xd7b(v=vs.110)
Possible causes for this error include the following:
An assembly that contains the definition of a type was not referenced in the compilation; use /reference (Import Metadata) to specify the assembly
You passed a variable name to the typeof operator.
You tried to reference an assembly that is not part of your target .NET Framework profile. For more information, see Troubleshooting .NET Framework Targeting Errors.
In my case, the issue is that an assembly that is not part of my target .NET Framework profile.

Google APIs/OAuth2 for .NET: dll integration/version issue

Ran the following in NuGet:
PM > Install-Package Google.Apis.Calendar.v3 -Pre
PM > Install-Package Google.Apis.Auth.Mvc -Pre
Per instructions at following locations
https://code.google.com/p/google-api-dotnet-client/wiki/OAuth2
https://www.nuget.org/packages/Google.Apis.Calendar.v3/1.7.0.72-beta
https://www.nuget.org/packages/Google.Apis.Auth.Mvc
After adding these to the project and just a leaving a reference to Google.Apis.Calendar.v3.Data from a previous version that did not make use of the newly added references I get the following when attempting to build (I have tried cleaning first)
The type 'Google.Apis.Requests.IDirectResponseSchema' is defined in an assembly
that is not referenced. You must add a reference to assembly 'Google.Apis,
Version=1.7.0.24060, Culture=neutral, PublicKeyToken=null'.
Additional Facts
Google.Apis is definitely included.
The version number the Google.Apis dll reference added by NuGet is 1.7.0.34454
I checked in the registry (under .NET 4) and am running v4.5.xxxx
While solution explorer shows the assemblies under references they do not show up in the object explorer
When trying to reference namepaces/classes in these assemblies Intellisense is able to find them but when you build it says that it can not find the referenced namespace(s)
I verified that all google dlls are from the 1.7.x.xxxx (different build numbers)
We were originally referencing an older version of Google Calendar API but that reference was definitely updated to the most recent version
Exchanging the Google Calendar namespace reference with
using Google.Apis.Auth;
results in
The type or namespace name 'Auth' does not exist in the namespace 'Google.Apis'
(are you missing an assembly reference?)
This appears to have been a an issue with that particular version of the Google APIs, Google seems to have fixed it in the most recent version.

Categories