1

I needed to make a console application using nettiers class libraries. I created a new Console Application project, added references to all the libraries from NetTiers and created an app.config file with all the necessary configurations. I get intellisense and no errors and everything when I am doing the coding, but when I go to compile the application, I'm getting an error that PPGEDI.Data doesn't exist.

I only have 1 line in the program.cs Main method:

PPGEDI.Entities.VansEntity van 
  = DataRepository.VansEntityProvider.GetById(16);

I'm getting the following error:

Error   93  
   The type or namespace name 'Data' 
   does not exist in the namespace 'PPGEDI' 
   (are you missing an assembly reference?) 

It's frustrating, because I know I've added the assembly reference:

enter image description here

I'm using Visual Studio 2010, with C# and .NET 4.0. Can anyone give me an idea as to what I need to do to get this to work.

As a note, this works if I use the same statement in a method on an ASPX page in the web application generated by nettiers.

stephenbayer
  • 12,373
  • 15
  • 63
  • 98
  • 2
    are you using the .NET client profile in your console app by chance? If so switch to the full .NET 4 as target framework – BrokenGlass Aug 17 '11 at 19:44
  • Also, unless someone can confirm (I'm not familiar with these libraries), take a look at that assembly in your favorite IL decompiler (Reflector, ilSpy, etc.) and ensure that there *are* actually types in that namespace defined within that assembly. – Adam Robinson Aug 17 '11 at 19:46
  • .NET versions possible conflict? Did you try to make your project of .NET 2.0 or 3.5? – Tigran Aug 17 '11 at 20:03
  • @Adam Robinson It is actually in that namespace and class name. BrokenGlass: I am not using the .NET client profile as my framework, I am using the full .NET 4 – stephenbayer Aug 17 '11 at 20:04
  • @Tigran everything in the entire solution is using .NET 4.0. I have gone down all the class libraries and have verified this. – stephenbayer Aug 17 '11 at 20:05
  • @BrokenGlass, you were absolutely correct. I double checked and it was set to ".NET Framework Client Profile", I changed it to .NET 4 and it's working now, can you put that as an answer? – stephenbayer Aug 17 '11 at 20:12

1 Answers1

1

@BrokenGlass, you were absolutely correct. I double checked and it was set to ".NET Framework Client Profile", I changed it to .NET 4 and it's working now, can you put that as an answer?

You are using the .NET client profile in your console app which is a "minified" version that doesn’t contain all assemblies.

The problem is that when your app adds a reference to a class library that is targeting the full framework, references to the "full" framework assembly will not resolve. This results in the rather non-forthcoming error message that you see. Switching to the the full .NET 4 as target framework will resolve the issue.

For a more in depth overview of the problem and the .NET 4 Client Profile in general also see "What’s new in .NET Framework 4 Client Profile RTM"

BrokenGlass
  • 158,293
  • 28
  • 286
  • 335