Facebook Connect with ASP.NET using Facebook Toolkit - asp.net

I have done the following steps here http://wiki.developers.facebook.com/index.php/How_Connect_Authentication_Works but I'm stuck at number 8. I've added the DLL's but for some reason this line:
API api = new API();
always comes up with this error:
Compiler Error Message: CS0246: The
type or namespace name 'API' could not
be found (are you missing a using
directive or an assembly reference?)
I am actually almost done with the article in DEVTACULAR and its pre-requisites. But somehow I am stuck with this problem.
Need help badly. Thanks :)

You have to import Facebook.Session by putting the following at the top of your class:
using Facebook.Session;
You could also just use the fully qualified name like:
Facebook.Session.Api api = new Facebook.Session.API();

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.

DbSet<> Does not Contain A Definition For 'ToListAsync()' Although I'm Using .NET 3.1 with EF Core

So I tried to add async methods to my routes and to the interfaces, repositories etc and I coded everything properly. Everything looks great but when I try to run the app I get that error:
Error CS1061: 'DbSet<Hotel>' does not contain a definition for 'ToListAsync' and no accessible extension method 'ToListAsync' accepting a first argument of type 'DbSet<Hotel>' could be found (are you missing a using directive or an assembly reference?) (CS1061)
I downloaded EF Core package and even hard coded most of the things since .NET does not detect anything related to async methods.
Do you know why I get this error?
I could not find any solutions. EDIT: I'm on a Mac btw.
Use this namespace
Microsoft.EntityFrameworkCore

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.

.Net Core 3 Asking for Namespace that already exists

Hoping someone can help, ive just updated some nuget packages (from .net core preview to 3) ran a build and now get an error saying:
The type name 'SqlConnection' could not be found in the namespace. This type has been forwarded to assembly Consider adding a reference to that assembly.
As you can see from the image below i have got the names in there. but i believe the grey means that it doesnt think its using it? and im getting the error.
Any ideas on how to fix the issue?
Thanks

Compilation Error with XDocument

I have been working on a website for a car dealer. When getting the website ready to go live we came to the realization that the server they use is set up with the 3.5 framework and unfortunately I had built the site in 4.0 not 3.5. After changing the site over I now get a Compilation Error.
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'XDocument' could not be found (are you missing a using directive or an assembly reference?)
Line 99: //query the database to search for New cars only
Line 100: XDocument feed = XDocument.Load(Server.MapPath("VEHICLES.XML"));
I think the error is that I am calling my assembly references in the code behind file and then calling XDocument within the page itself so I can run the search and then Response.Write the results right onto the page. This works in 4.0 but in 3.5 it seems to not be able to find the assembly. I did not use a repeater for this because I needed to check certain things, such as if the car is certified or not as I list them on the page so I can make changes, this didnt seem to work with a repeater.
If anyone has any ideas on how to fix this error or how to go about it more effectively I would really appreciate it.
Add this to the top of the class...
Using System.Xml.Linq
If you still get the error, add the System.Xml.Linq.dll reference to your project.

Resources