user884248
user884248

Reputation: 2244

C# project recognizes User Control from references project in designer, but not when compiled

I know that this is a very general question, but...

I have a Visual Studio 2010 Winforms C# project. I added a C# project from an external vendor to the same solution. I am referencing this vendor's project in my project.

This external project implements a custom ListView control that I want to use.

I place the control on my main form, even set some properties - everything works fine: I see the listview on my form..

But... when I try to build, it tells me

Error   37  The type or namespace name 'CustomListView' does not exist in the namespace 'CustomNamespace' (are you missing an assembly reference?)

The CustomListView class definitely DOES exist in the namespace CustomNamespace in the vendor's code. The class is public. I can right click it in InitializeComponent, click "Go to implementation", and I get to

namespace CustomNamespace {
    public partial class CustomListView {
        .... 
    }
}

Has anyone had anything like this happen to them?

EDIT: I found a hint. I have another custom control in there, called SplitButton, that inherits from Button. The code for this control is a part of my project and under the main namespace. When I add the CustomListView control, after reloading the project, I suddenly can't display the form anymore: it says it can't find the SplitButton class. When I delete all references to CustomListView, suddenly SplitButton works fine and the form can be displayed.

These controls have nothing in common whatsoever. Is it possible that this external CustomListView control somehow tampers with namespace resolution?

Upvotes: 0

Views: 81

Answers (1)

Tsef
Tsef

Reputation: 1038

As requested I'm posting my comment as an answer:

Try checking the "Target Framework" under Project Properties->Application tab. If it's set to Client Profile then try setting it to Full Framework (i.e .Net Framework 4)

Upvotes: 1

Related Questions