Search code examples
dllbuildazure-devopsdevopsazure-pipelines-build-task

AzureDevOps Error The type or namespace name 'MyNamespace' could not be found (are you missing a using directive or an assembly reference?)


This is not a duplicate. I am creating a build pipeline in AzureDevOps for my Asp.Net c# Application, which is using Git as the source repository. The aplication is having few external dlls, which are not available in Nuget. These dlls are placed in a project folder with name dependencies and is referred from there. The application builds fine in all developer machines. When the build pipeline is the build fails with below error.

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

This is happening for all the external dependency references.

Any help on this is appreciated.


Solution

  • Posting the solution that I found, since this can help someone. Make sure the dependencies are available.

    For me, I was using Git LFS for dlls. The dlls were not getting checked out by default, which was causing the issue.

    I have added below lines, which resolved the issue.

    steps:
    - checkout: self
      lfs: true
    

    The solution was to check out the lfs explicitly. Thanks for the help.