Reputation: 419
I have one web application with two projects:
Project "Website"
Using CMS;
namespace Web
{
}
Project "CMS"
namespace CMS
{
public class Functions
{
}
}
Then I want to be able to use CMS.Functions.MyMethod()
inside Website.Web.
Im having some problem with this.. Inside the "Website" project I have added "CMS" as a reference and I have also added Using CMS;
and even tho the intellisense picks up CMS.Functions I get an error! The word CMS
gets underlined blue and I get the message:
The name 'CMS' does not exist in the current context
What am I missing out? Its so weird becuase I can write CMS.Functions
and the "Functions" part comes up in the intellisense but when I finish the line the word CMS
gets underlined blue and I get the error even tho I got a reference and a Using statement.
Upvotes: 0
Views: 156
Reputation: 44971
The most likely cause is that you have not added a reference to the CMS project to your main project. That is the only time that I get the exception about the name not existing in the current context.
Upvotes: 0
Reputation: 6113
From the sound of it, you want to make your Functions class methods to be static
namespace CMS
{
public class Functions
{
public static void MyMethod(){
//do stuff
}
}
}
Upvotes: 3