Receiving “The name {ProjectNamespace} does not exist in the current context” when trying to include namespace

StackOverflow https://stackoverflow.com/questions/7046991

Question

I have three projects:

  1. TestNHibernateMappings - A console project
  2. WebApplicationPbiBoard - An Asp.Net MVC 3 Web project
  3. WebApplicationPbiBoard.Tests - An MsTest project

TestNHibernateMappings needs a reference to the PbiMap class located in WebApplicationPbiBoard.Models.ScrumModels_Mappings.

I've added WebApplicationPbiBoard as a project reference to TestNHibernateMappings, but Visual Studio keeps giving me namespace non-existence error when I try to include it. I've also tried removing and re-adding the reference, and performing a clean build of the entire solution both with no luck.

Any idea how to fix this? I've tried teaching my project about Descartes and disabling the Solipsist=true flag in the Console App, but those didn't work out either. Thanks in advance.

Here's the relevant code:

    MsSqlConnectionStringBuilder builder = new MsSqlConnectionStringBuilder();
    builder.Database("WebApplicationPbiBoard");
    builder.Server("local");
    builder.TrustedConnection();

    return Fluently.Configure()
        .Database(MsSqlConfiguration.MsSql2008.ConnectionString(builder.ToString()))
        .Mappings(m => m.FluentMappings.AddFromAssemblyOf<WebApplicationPbiBoard.Models.ScrumModels_Mappings.PbiMap>())
        .BuildSessionFactory();

The Fluently.Configure()... part is my attempt to configure a FluentNHibernate Session.

Was it helpful?

Solution

Check the target framework for TestNHibernateMappings and set it to .NET Framework 4.0. I suspect that you currently have it set to .NET Framework 4.0 Client Profile and that is the issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top