1
votes

My solution has multiple projects with Internal reference to each other. Project name DataAccess references Objects project. In my NANT script I first compile the Objects folder which succeeds and then when I try to compile DataAccess project I get the assembly reference error which is as below;

error CS0246: The type or namespace name 'CustomerProfile' could not be found (are you missing a using directive or an assembly reference?)

CustomerProfile Class is part of the Objects project and I am clearly mentioning the reference in the NANT as shown below;

<csc target="library" output="${OutputFolder}\bin\Objects.dll" debug="${debug}">
    <references />
    <sources basedir="${SourceCodeFolder}">
        <include name="Objects\\**\*.cs" />
    </sources>
</csc>
<csc target="library" output="${OutputFolder}\bin\DataAccess.dll" debug="${debug}" >
    <references>
        <lib>
            <include name="${OutputFolder}\bin" />
        </lib>
        <include name="Objects.dll" />
    </references>
    <sources basedir="${SourceCodeFolder}">
        <include name="DataAccess\\**\*.cs" />
    </sources>
</csc>  

Weird thing is if I remove the <include name="Objects.dll" /> from the reference section I get the below error;

error CS0234: The type or namespace name 'Objects' does not exist in the namespace '' (are you missing an assembly reference?)

Which confirms that the assembly references should b given the way I have given in the above code snippet. But I fail to understand that if the assembly refernce is done correctly then how come the class ('CustomerProfile') withing that assembly is not getting picked up

Can any one please help?

1

1 Answers

0
votes

Got the issue resolved with the help of my ex colleague. In the references section full path to the dll should be mentioned. Below the code snippet after the fix;

<csc target="library" output="${OutputFolder}\bin\DataAccess.dll" debug="${debug}" >
    <references>
        <include name="${OutputFolder}\bin\Objects.dll" />
    </references>
    <sources basedir="${SourceCodeFolder}">
        <include name="DataAccess\\**\*.cs" />
    </sources>
</csc>