1

I'm trying to add an existing project to another project with-in my solution.

When I go to MvcProject.2 and add a new reference to MvcProject.1 and save it, it is added to the References section and the data models load up in the object explorer. Only problem I'm having is that I'm not able to do using MvcProject.1; because there's no namespace found in the project, even the the assembly reference has been loaded. Is there a step I'm missing here? I followed the instructions on here best I could, but no luck: How do you share code between projects/solutions in Visual Studio?

Community
  • 1
  • 1
RealWorldCoder
  • 1,031
  • 1
  • 10
  • 16

2 Answers2

2

Check that the Target Framework values in the Properties of both projects are the same.

Igor
  • 15,833
  • 1
  • 27
  • 32
1

Inside the project in Visual Studio, right click on the MvcProject.1 reference in the References folder and choose View In Object Browser. This will load a list, expand MvcProject.1, the first child will have an icon of curly braces that is the namespace name; whatever value is there is what you can use in your using statement.

Karl Anderson
  • 34,606
  • 12
  • 65
  • 80
  • Exactly what I thought, but the problem is I get squiggly red underline and the `.1` when I am trying `using MvcProject.1;` and it doesn't intellisense me the namespage when I just have a `.` – RealWorldCoder Oct 11 '14 at 01:39
  • Does object browser actually show the namespace `MvcProject.1`? – Karl Anderson Oct 11 '14 at 01:41
  • Yes with all the Models,Controllers, Think it's just a glitch? I tried re-opening it. I'm trying `using` in global.asax, could this be a reason? – RealWorldCoder Oct 11 '14 at 01:42
  • No, you are allowed to use `using` statements inside the `global.asax` code-behind (i.e. `global.asax.cs`), there should be a bunch of system ones there by default. – Karl Anderson Oct 11 '14 at 01:47
  • There is, but I can't get this to work. I just rebuilt `1` and tried again, still no use. Any suggestions? – RealWorldCoder Oct 11 '14 at 01:50
  • This is a longshot, but try changing the number `1` to the word `One`. I know that types in .NET cannot start with numbers and I realize that your instance of the number `1` is not at the beginning, but it is the only thing that sticks out from the information you have provided. – Karl Anderson Oct 11 '14 at 01:54
  • Well it is a character, not a number. It's only a number in this question as an example. – RealWorldCoder Oct 11 '14 at 01:58
  • Yea, it was a glitch. It started working now. I knew it was a glitch – RealWorldCoder Oct 11 '14 at 05:14