简体   繁体   English

VS2010-PresentationFramework程序集。 为什么?

[英]VS2010 - PresentationFramework assembly. Why?

========= Update (Reed Copsey)========== =========更新(Reed Copsey)==========

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) { }
        }
    }

======================================== ========================================

Hello, 你好,

I am really newbie to c# and VS2010. 我真的是C#和VS2010的新手。 :-\\ : - \\

I have a "pure" Winforms application. 我有一个“纯” Winforms应用程序。 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: 但是突然(对源代码进行了最后更改)构建辅助DLL时出现此错误:

Error 7 The type 'System.Windows.Interop.HwndHost' is defined in an assembly that is not referenced. 错误7类型'System.Windows.Interop.HwndHost'是在未引用的程序集中定义的。 You must add a reference to assembly ' PresentationFramework , Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. 您必须添加对程序集' PresentationFramework ,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'的引用。 D:\\MyprojectPath\\SharedExceptions.cs AuxLibraryProject 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. 我不想将PresentationFramework.dll添加到项目中,即使我尝试添加它,也需要许多其他程序集。 :-( :-(

I want to know WHERE is the guilty of this assembly requirement. 我想知道WHERE是此装配要求的罪魁祸首。 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. SharedExceptions.cs是更改的文件之一,但是当我(手动)删除所有更改时,错误仍然存​​在。

This same assembly compiles fine on a Windows XP Visual Studio 2010 system. 在Windows XP Visual Studio 2010系统上,该程序集可以正常编译。 But not on Windows Vista. 但不是在Windows Vista上。 :-O :-O

Any clue ? 有什么线索吗?

Thanks. 谢谢。

I have found it: 我发现了:

This line on top of namespace keyword on two assemblies was the culprit: 在两个程序集中的namespace关键字之上的这一行是罪魁祸首:

[assembly: CLSCompliant(true)]

I have deleted this line on both assemblies and all builds fine now. 我已经删除了这两个程序集上的这一行,并且现在一切都构建良好。

Greetings. 问候。

You are either referencing HwndHost , or something you added is referencing HwndHost . 您正在引用HwndHost ,或者添加的内容正在引用HwndHost This is defined in PresentationFramework.dll. 这在PresentationFramework.dll中定义。

You'll need to track down the culprit. 您需要找出罪魁祸首。 It's in your SharedExceptions.cs file. 它在您的SharedExceptions.cs文件中。 There is obviously at least one change that didn't get backed out completely in that file. 显然,至少有一个更改没有完全撤消该文件中。

(This, btw, is one huge advantage of using one file per class... I'm guessing that you have MANY exception types defined in that file, which is why you're not just seeing this instantly.) (顺便说一句,这是每个类使用一个文件的巨大优势……我猜您在该文件中定义了许多异常类型,这就是为什么您不能立即看到这种情况。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM