1

I have a VS2010 solution with a "hello world" WPF Application and a Class Library project. In my class library, I have defined a class in a namespace called ReportImageMerge.Core. I have that project referenced by my WPF app project, but when I run the build, I get several errors. The parent error of the rest which are references to objects within my custom namespace is this:

Error   3   The type or namespace name 'Core' does not exist
in the namespace 'ReportImageMerge' (are you missing an assembly reference?)

Strangely, if I remove the project reference and add it back, my errors disappear along with all red squigglies. Only when I rebuild do I see the errors anew. The namespace and class are defined as below:

namespace ReportImageMerge.Core.Business
{
    public class ReportHelper
    {
        ...
    }
}

The class and name are referenced as below:

using ReportImageMerge.Core.Business;

namespace ReportImageMerge.Reporter
{
    public partial class MainWindow : Window
    {
        public ReportHelper ReportHelper { get; set; }
        ...
    }
}

The only information I have found related to my issue seem to be centered around target framework. The WPF Application is set to ".NET Framework 4 Client Profile" by default, and the class library is set to ".NET Framework 4". Most advice for people with Silverlight projects referencing class libraries was to use a Silverlight-specific class library. There doesn't appear to be the same for WPF app projects.

I have seen advice given to change the target framework of the referencing project to the same as the referenced app, but I get an unspecified runtime error if I do that.

How can I get my class library namespace to be recognized after building my solution?

PancakeParfait
  • 175
  • 1
  • 9

1 Answers1

5

You cannot reference the full framework from the client framework.

Change either of the projects so that they both target the same framework.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • Thanks for your prompt response, SLaks. While I had already tried changing the WPF project to non-Client Profile (and received an unspecified runtime exception as mentioned above), I had yet to try the other way around. When I do, my old problem goes away, but this causes my references to several Crystal Reports namespaces to fail. Any further thoughts on that? – PancakeParfait Dec 23 '11 at 15:56
  • What exception and stack trace? – SLaks Dec 23 '11 at 16:02
  • Looks like it was pointing to a constructor for my ReportHelper class in which I referenced a connection string not present in the App.config. Sometimes all it takes is to just ask someone about it and your perspective changes enough to actually listen to what the IDE is telling you ._. Thanks for your help, SLAks, all is well! – PancakeParfait Dec 23 '11 at 16:10