© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
1 reply
alpacasierra

NetArchTests Not Detecting Project References

anyone here familiar with netarchtests? I am trying to enforce clean architecture, and for some reason, it is not detecting project references:

    [TestMethod]
    public void Application_ShouldNotHave_DependencyOnOtherProjects()
    {
        var assembly = typeof(Application.AssemblyReference).Assembly;
        var otherProjects = new[] { CoreNamespace, InfrastructureNamespace, ContractsNamespace, ApiNamespace, ArpNamespace };

        var test = Types.InAssembly(assembly)
            .ShouldNot()
            .HaveDependencyOnAny(otherProjects)
            .GetResult();

        Assert.IsTrue(test.IsSuccessful, GenerateErrorMessage(test)); 
    }
    [TestMethod]
    public void Application_ShouldNotHave_DependencyOnOtherProjects()
    {
        var assembly = typeof(Application.AssemblyReference).Assembly;
        var otherProjects = new[] { CoreNamespace, InfrastructureNamespace, ContractsNamespace, ApiNamespace, ArpNamespace };

        var test = Types.InAssembly(assembly)
            .ShouldNot()
            .HaveDependencyOnAny(otherProjects)
            .GetResult();

        Assert.IsTrue(test.IsSuccessful, GenerateErrorMessage(test)); 
    }


The above test should fail, but isnt -- note: assume namespace strings are correct
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Mixed Project References
C#CC# / help
2y ago
NuGet package project references
C#CC# / help
17mo ago
✅ link A project's file to B project which references A project
C#CC# / help
16mo ago
❔ Project References Different SDK Versions: Visual Studio Fails, Rider Does Not?
C#CC# / help
3y ago