Reputation: 4404
I have a solution with 4 projects with these namespaces:
namespace TPCO
namespace TPCO.Controllers
namespace TPCO.Models
namespace TPCO.Core.Data
namespace TPCO.Core.Domain
namespace TPCO.Core.Models
namespace TPCO.Data
namespace TPCO.Tests.Controllers
The TPCO.Core and TPCO.Data projects were originally part of an ASP.Net Web Application. I imported them into an ASP.Net MVC5 application solution containing the TPCO and TPCO.Test projects.
For some reason, I cannot see any of the namespaces from TPCO.Core or TPCO.Data from TPCO. I also cannot see TPCO, TPCO.Controllers or TPCO.Models from TPCO.Core or TPCO.Data projects. However, I can see TPCO.Core.* from TPCO.Data and vice versa.
And from TPCO.Tests, I can only see the namespaces from the TPCO and TPCO.Tests projects.
All projects have same target framework, per: Namespace not available in other project
Also, ALL classes in TPCO.Core and TPCO.Data are marked public
What is going on and how do I remedy this? Could it be that the TPCO.Core and TPCO.Data projects reside outside the folder structure of the MVC app that is causing this?
Upvotes: 0
Views: 1005
Reputation: 5109
Check how the projects reference each other. They should be set up as project references. If they are set as dll references then VS is looking for the compiled dll in a specific folder.
I think the easiest way to check this is by opening the .csproj in notepad. Find the ItemGroup for the reference and ensure it is a project.
Project Reference:
<ProjectReference Include="..\DataInterface\DataInterface.csproj">
<Project>{b0c3500f-6d72-46f5-a8e9-5283fa116db2}</Project>
<Name>DataInterface</Name>
</ProjectReference>
DLL Reference:
<Reference Include="DataInterface">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Dlls\DataInterface.dll</HintPath>
</Reference>
Then, if it is a dll reference, remove it from the project's references and add it back in as a project reference.
Upvotes: 2