Answered using Fail

Edu151979

New member
Joined
Feb 10, 2021
Messages
1
Programming Experience
1-3
Olá colegas sou novo por aqui, me desculpe se fia algo errado, mas estou com um problema que esta me fundindo a cuca.
quando vou declarar algo um assembly no using ela não encontra mesmo já estando referenciado.
Alguém já passou por isso e sabe a solução?

using.png

Mod edit : Post as thumbnails, not huge inserts
 
Last edited by a moderator:
Please post in English in these forums. Translate your post.
 
Also, please don't post a massive screenshot of your entire screen when only a small part of it is relevant. You should be trying everything you can to help us by posting everything that is relevant and nothing that isn't.
 
Since our OP hasn't come back, I have a suspicion that the problem he is running into is that he is assuming that C# is like Java where the .JAR name much exactly match the namespace. (Un)fortunately, that is not true in C#. There is no requirement that the name of the assembly match the name of the namespace(s) inside the assembly. Although as I recall there were a version or two of Visual Studio that tried to "encourage" this Java-ism by naming the namespaces based on the directory structure. I always override it.

So for our OP, in case you come back, you can have the following:
C#:
namespace ABC
{
    public class Foo
    {
    }

    namespace DEF
    {
        public class Bar
        {
        }
    }
}

and put all of that into an assembly named "XYZ.dll".

The reference in the Solution Explorer would be to "XYZ.dll", but the code which uses it would have to be written as:
C#:
using ABC;
using ABC.DEF;

Also as a quick aside, based on that screenshot, it looks like the "DAL" project and "BLL" project are both part of the same solution. Therefore, you should add a "Project Reference" in "BLL" to "DAL", not an "Assembly Reference". This will let Visual Studio help you much better by knowing when "BLL" needs to be recompiled due to changes in "DAL", as well as help it fill out the Intellisense and XML documentation help.
 

Latest posts

Back
Top Bottom