I am really newbie to c# and VS2010. :-\
I have a "pure" Winforms application. Or at least I think so.
But suddenly (with the last changes to the source code) I have this error when build an auxiliary DLL:
Error 7
The type
‘System.Windows.Interop.HwndHost’ is
defined in an assembly that is not
referenced. You must add a reference
to assembly ‘PresentationFramework,
Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35′. D:\MyprojectPath\SharedExceptions.cs AuxLibraryProject
I don’t want to add PresentationFramework.dll to the project and even when I have tried to add it then a lot of other assemblies are required. 🙁
I want to know WHERE is the guilty of this assembly requirement. I will be happy to blame some line on my source code but I cannot find it.
The SharedExceptions.cs is one of the files changed but when I (manually) delete all changes, the error persists.
This same assembly compiles fine on a Windows XP Visual Studio 2010 system. But not on Windows Vista.
Update:
I have left alone the parent exception for all others. All other are on other files. After rebuild, the error remains on the same file. Here is the little source code. I cannot see anything requiring the new assembly:
using System;
namespace PROJECT.AuxLibraryProject
{
public class SharedExceptionParent: Exception
{
public string ErrorMessage
{
get
{
return base.Messsage.ToString();
}
}
public SharedExceptionParent() { }
public SharedExceptionParent(string errorMessage) : base(errorMessage) { }
public SharedExceptionParent(string errorMessage, Exception innerEx) : base(errorMessage, innerEx) { }
}
}
I have found it:
This line on top of namespace keyword on two assemblies was the culprit:
I have deleted this line on both assemblies and all builds fine now.
Greetings.