locked
CLASS LIBRARY PROJECTS RRS feed

  • Question

  • I am trying to create a class library project, but 'myClass' created using VS-2015 depends on 'myOtherClass' and adding the latter to 'myClass' project does not resolve the dependencies.

    'myOtherClass' defines a enum called error_t, 'myClass' uses this enum as a variable that is passed between functions/methods.

    '[Solution Explorer]myClass->Add->Existing item...' does add the myOtherClass.cs, but as I said, it does not resolve the dependencies i.e. myClass::myMethod(myOtherClass.error_t err) displays with a red line under it, intellisense, reporting the problem.

    What can I do to resolve this issue.

    Monday, January 25, 2016 1:57 PM

Answers

  • Make sure you have added your dll as a reference and include the namespace as to where the class file you're trying to use is located.

    Here shows that I have referenced my dll.

    This is the namespace of the class that I want to use.

    And here is where I am using that namespace of the dll which allows me to use the method "ToArgbString"
    The red is the namespace and the blue is the method.

    Monday, January 25, 2016 5:15 PM

All replies

  • I am trying to create a class library project, but 'myClass' created using VS-2015 depends on 'myOtherClass' and adding the latter to 'myClass' project does not resolve the dependencies.

    'myOtherClass' defines a enum called error_t, 'myClass' uses this enum as a variable that is passed between functions/methods.

    So why are not both classes in the same classlibrary? You know you can do that, right?

    Monday, January 25, 2016 2:33 PM
  • Identifiers are found by looking at their full name which includes the namespace and type. If you adding a file to your project that came from another project then the file is still using the namespace from the other project, hence you probably will get resolution errors by the IDE/compiler. Open the file you added and change the namespace to match your current project. If that doesn't resolve the issue then please post the relevant code and the error you're getting.

    Michael Taylor
    http://blogs.msmvps.com/p3net

    Monday, January 25, 2016 3:12 PM
  • Hi

    Please check for namespace of myOtherClass and add that in myclass as "using" namespace  statement to resolve the dependencies. if this is not resolving share screenshots or sample code snippet

    Monday, January 25, 2016 3:49 PM
  • Make sure you have added your dll as a reference and include the namespace as to where the class file you're trying to use is located.

    Here shows that I have referenced my dll.

    This is the namespace of the class that I want to use.

    And here is where I am using that namespace of the dll which allows me to use the method "ToArgbString"
    The red is the namespace and the blue is the method.

    Monday, January 25, 2016 5:15 PM