SOLVED: Type 'IOAuthCredentials' is not defined. (and many more)

Jan 29, 2012 at 7:07 PM
Edited Jan 29, 2012 at 7:48 PM

SOLVED: Had to change target framework to .Net Framework (without Client reference)

Now that I got the DLL installed, I created a VB EXpress 2010 windows desktop project, referenced the DLL and brought in your demo Module1 and app.config files.  I then created just a basic form with a button and called the module from the click event.  I get 36 errors, among which are:

Type 'IOAuthCredentials' is not defined.

Type 'PinAuthorizer' is not defined.

Type 'TwitterContext' is not defined.

and many more.  :(

I even get an undefined error for Imports LinqToTwitter.

 

Any idea what could be causing this?  It happened on another VB Express project with the TwitterVB DLL, but not on other projects... even another using that same DLL.  Maddening.

UPDATE: if I hover over the Imports statement, I do get a popup error:

Namespace or type specified in the Imports 'LinqToTwitter' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

?

 

UPDATE 2: Just noticed this warning:

Warning 1 The referenced assembly "LinqToTwitter" could not be resolved because it has a dependency on "System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. WindowsApplication1

 

There are other warnings, too, for System.Web (which is available, and I added it) and System.Web.Abstractions (which is not) and System.Web.Routing (also not available).

I'll keep searching and digging, but hopefully someone smarter than I am knows what's going on here...

 

SOLVED: Had to change target framework to .Net Framework (without Client reference)

Coordinator
Jan 29, 2012 at 8:01 PM

Hi,

I'm not familiar with VB Express, but am wondering if you're running in Client Profile mode, which is a sub-set of the full .NET Framework.  Many assemblies available to the full .NET Framework aren't available in the Client Profile, which is why you would see errors like that.  I'm thinking the setting should be somewhere in your project property pages.  Here's how I find that setting in my version of Visual Studio:

  1. Double-click the My Project folder in the Solution Explorer Project. You'll see a properties screen.
  2. Click on the Compile tab.
  3. Scroll to the bottom of the Compilation properties window.
  4. Click the Advanced Compile button. You'll see an Advance Compiler Settings dialog.
  5. In the Target Framework drop-down, change the selection from ".NET Framework 4 Client Profile" to ".NET Framework 4".

Joe

Jan 29, 2012 at 8:26 PM

Yeah, it looks like VB Express defaults to Client mode for this type of project.  I already went through the steps you mention after finding help elsewhere, and marked this "SOLVED".  This was a REALLY difficult one to troubleshoot... but you sure nailed it quick!

I'm now getting some other errors when trying to authenticate using your example code, but I'll see if I can figure them out.

Thanks again!

Mar 19, 2014 at 4:45 PM
Hi Joe,

I am getting this error now too, but I do not have .net client profile installed at all on my machine. I tried getting .net updated to 4.0.3 but that did not work either.. I am trying to use the older 2.1.11 version as I want to avoid upgrading my project to .net 4.5 (as I still need to use visual studio 2010).

What do you suggest?
Coordinator
Mar 25, 2014 at 6:45 PM
Hi,

If you're using VB, you need an Imports declaration for the LinqToTwitter namespace.
@JoeMayo
Apr 1, 2014 at 5:40 PM
Hi Joe,

I think I found the issue, I have the imports decleration and a reference to the .dll, but needed to move the .dll to the bin directory for my project