Reputation: 716
I am attempting to create a C# class library for some Yahoo Placefinder work. I did not find VB code examples online, so I thought I would use the C# code they provide and simply add another class library project to my solution and save myself some time.
However, no matter what I do, I can't seem to get my VB windows service project to recognize the imports namespace.
I have repeatedly added referenced within the VB windows service project to the C# library (see below)...
...but nothing seems to cause it to recognize it properly.
Below is the class code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OAuth;
namespace YahooRequest
{
public class YahooR
{
/// <summary>
/// Request Address from Yahoo BOSS Placefinder
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
public static string RequestAddress(string[] args)
{
string consumerKey = "...";
string consumerSecret = "...";
var uri = new Uri("https://yboss.yahooapis.com/geo/placefinder?location=" + args[0]);
string url, param;
var oAuth = new OAuthBase();
var nonce = oAuth.GenerateNonce();
var timeStamp = oAuth.GenerateTimeStamp();
var signature = oAuth.GenerateSignature(uri, consumerKey,
consumerSecret, string.Empty, string.Empty, "GET", timeStamp, nonce,
OAuthBase.SignatureTypes.HMACSHA1, out url, out param);
using (WebRequest response = WebRequest.Create(string.Format("{0}?{1}&oauth_signature={2}",
url, param, signature)).GetResponse())
{
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
return reader.ReadToEnd();
}
}
}
}
}
Any suggestions as to why this library simply won't be recognized by Visual Studio?
UPDATE 1
A comment directed me to look at the object viewer, which does have the class library displayed, it does not show any functions. I'm not sure why this is, but I feel like it has something to do with my problem.
UPDATE 2
Code originally came from Yahoo.
Upvotes: 2
Views: 2278
Reputation: 221
Make sure your project is selected and then go to projects and click on "Add Reference" to to import your Class Library
Upvotes: -1
Reputation: 78155
If the Studio complains the referenced library contains no public classes or methods, that is most likely true.
Check that code modules that contain actual library code indeed compile (the Build Action type must be 'Compile').
Upvotes: 2