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

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.

Related

The type or namespace name 'Optimization' does not exist in the namespace

I am running into an issue where The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' when it was already installed(I checked Nuget Package Manager)
What I have tried:
1: Directly copy dll to the Bin folder because I notice it was missing. This did not work.
2: Uninstall and re-install it from Nuget Package Manager, after that, the same error still exist. On top of that, I got a new error
The pre-application start initialization method Start on type
System.Web.Optimization.PreApplicationStartCode threw an exception
with the following error message: Could not load file or assembly
'Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
system cannot find the file specified..
Package Version: 1.1.3
It is a WebForm Project, not MVC(there are many posts have solutions that's unique to MVC, so it is not applicable in my case)
I have installed both packages with the highest stable version, so I am not sure why Infrastructure is yelling at me.
I have fortunately found the solution:
Web.Optimization requires Web.Infrastructure. When I reinstall Web.Optimization, it changed the targetFramework from 40 to 45, while Infrastructure is looking at 40. Also, despite the fact that I have infrastructure installed, the dll is also missing. I copied net40 version of dll for both Web.Optimization and Web.Infrastructure and then it worked.

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

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.

I was trying to run the demo provided in github, but none of them were working. failed to get the assembly reference

Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'LearningModelSession' could
not be found (are you missing a using directive or an assembly
reference?) MNIST_Demo C:\Users\ansifmx\Downloads\Windows-Machine-Learning-master
(5)\Windows-Machine-Learning-master\Samples\MNIST\UWP\cs\mnist.cs
25 Active
similar error with all namespace, references in windows.machinelearning.ai
https://github.com/Microsoft/Windows-Machine-Learning
tried all three demos provided...none worked
please advice new here
Tried everything on this link https://learn.microsoft.com/en-us/visualstudio/ide/troubleshooting-broken-references?view=vs-2015
Tried referring windows.ai.machinelearing.preview
Updated all reference nuggets
Reinstalled references
nuggets manager both the check points are slected are on allow nuggets to download missing plugins,
6.moved to repos
Most likely the referenced Nuget packges are not getting restored.
Verify the settings at Tools >> NuGet Package Manage >> Package Manager Settings and make sure that it is set to download any missing package during build.
The exact setting may differ slightly based on the VS version you are using.
After updating windows to 1809 build 17763 with the latest SDK 17763. I was able to run the demo. I hope this helps.

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

(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

Categories