Search code examples
wpfvisual-studio-2010enterprise-library

Trouble loading project references during build within wpf user control library


As an example of a build time assembly load issue, consider the following class library code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;

namespace ClassLibrary1
{
    public class Class1
    {
        SqlDatabase database;
    }
}

And the following class code in a wpf user control library:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClassLibrary1;

namespace WpfControlLibrary1
{
    class Class1
    {
    }
}

The WpfControlLibrary1 has a project reference to ClassLibrary1, but using ClassLibrary1; reference fails. A different project type can load ClassLibrary1 just fine, and if the Enterprise Library 5.0 SqlDatabase declaration is commented out, the wpf library can load ClassLibrary1.

Any ideas on what this issue is or how to track it down?

Thanks!


Solution

  • One possible cause is that WpfControlLibrary1 is targeting .NET Client Profile, but one of the other libraries (e.g. Enterprise Library) is targeting the full profile. You can check the "Target framework" setting in the project properties dialog, in the "Application" tab.

    You can see more details about the .NET Client Profile at http://msdn.microsoft.com/en-us/library/cc656912.aspx, or about changing the target at http://msdn.microsoft.com/en-us/library/bb398202.aspx.