I have 2 projects:
Tests.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using
using NUnit.Framework;
using Ninject;
using ConstrainedScheduleInterfaces;
namespace ConstrainedSchedule.Testing
{
internal static class Configuration
{
...........
}
}
I added the reference to the ConstrainedSchedule project, but the using ConstrainedScheduleInterfaces;
is marked red as not found.
Both the project has destination framework set .NET Framework 4.5
Any help? Thanks
A namespace can contain another namespace. It is called nested namespace. The nested namespace and its members can also be accessed using the dot (.) operator.
All parts of a partial class should be in the same namespace. Each part of a partial class should be in the same assembly or DLL, in other words you can't create a partial class in source files of a different class library project.
First, you need to add the project which contains the utility operations as a reference to the project which will be using them. If you're using Visual Studio Code or command line, you can use dotnet add reference command to do that, and in Visual Studio you can use Reference Manager.
Inside a namespace, no two classes can have the same name.
Does the project contain a reference to the other project? You can't just add the namespace, the project itself needs an assembly reference to the other project which has that namespace.
In Visual Studio, open the Solution Explorer. Right-click on the ConstrainedSchedule
project and select something along the lines of "Add Reference." In the dialog, select project references (depending on the version of Visual Studio it may be a tab or some other interface indicating projects as part of the solution). Select the ConstrainedScheduleInterfaces
project and add the reference.
More information here.
For other people who have this problem, who have already added the reference to the dll and have made sure you have the right namespace at the top, I've found another thing that can cause this.
Select-click the file in visual studio and choose properties
. In the Advanced part of properties, look for Build Action
. Change it to compile
if it's not already on that, and try to build again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With