简体   繁体   English

C#-引用类型'ISomeInterface'在未引用的程序集中定义

[英]C# - The reference type 'ISomeInterface' is defined in an assembly that is not referenced

I am in charge of migrating our companies core libraries from Compact Framework 2.0 that used to run on Visual Studio 2008 to Visual Studio 2015, Update 3 and .Net 4.6. 我负责将我们公司的核心库从曾经在Visual Studio 2008上运行的Compact Framework 2.0迁移到Visual Studio 2015,Update 3和.Net 4.6。 I have created new class libraries and have changed the references to point to the corresponding .Net version of the older libraries. 我创建了新的类库,并更改了引用以指向旧库的相应.Net版本。 For example, if we had a ProdoctCore library that was referencing Sender.dll and Utils.dll, in the new ProducCoreDotNet library, I have added its references to SenderDotNet.dll and UtilsDotNet.dll. 例如,如果在新的ProducCoreDotNet库中有一个引用Sender.dll和Utils.dll的ProdoctCore库,则我已将其引用添加到SenderDotNet.dll和UtilsDotNet.dll。 Then I have added the class files of the old Compact Framework to the new solution by adding them "as link". 然后,我通过“作为链接”添加旧的Compact Framework的类文件到新的解决方案。 So basically the project names have the extention DotNet but the namespaces have exactly the same name is before. 因此,基本上项目名称具有扩展名DotNet,但名称空间具有与之前完全相同的名称。

Now the problem that I'm facing is that I'm getting a strange error: 现在我面临的问题是我遇到了一个奇怪的错误:

"The reference type 'IMonitorComponent' is defined in an assembly that is not referenced. You must add a reference to assembly 'Utils, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null'" “引用类型'IMonitorComponent'在未引用的程序集中定义。您必须添加对程序集'Utils,Version = 1.5.0.0,Culture = neutral,PublicKeyToken = null的引用”

However, my UtilsDotNet's version is 1.0.0.0 and the old Utils was version 2.0.0.0. 但是,我的UtilsDotNet的版本是1.0.0.0,而旧的Utils的版本是2.0.0.0。

I've read couple of similar threads at SO but unlike what was mentioned in this question , the IMonitorComponent doesn't have any reference to other assemblies. 我已经在SO上阅读了几个类似的线程,但是与该问题中提到的不同,IMonitorComponent没有对其他程序集的任何引用。 It's simply an interfaces with couple of properties: 它只是具有几个属性的接口:

 public enum COMPONENT_STATUS
{
    ERROR,
    WARNING,
    OK,
    UNKNOWN,
    DISABLED
}

public class ComponentStatusProperty
{
    public ComponentStatusProperty(string name, COMPONENT_STATUS status, string message)
    {
        ComponentName = name;
        Status = status;
        Message = message;
    }

    public COMPONENT_STATUS Status { get; set; }
    public string Message { get; set; }
    public string ComponentName { get; set; }
}

public interface IMonitorComponent
{
    string Name { get; }
    List<ComponentStatusProperty> Statuses { get; }
    bool ComponentSoBrokenThatTheDeviceCannotWork { get; }
}

So I'm out of ideas and would appreciate your help. 因此,我没有想法,不胜感激您的帮助。 Also, please elaborate on you answers as I haven't done anything like this before. 另外,请详细说明您的答案,因为我之前从未做过这样的事情。

We finally found the reason. 我们终于找到了原因。 We were using another reference that was using the Utils version 1.5. 我们使用的另一个参考使用的是Utils 1.5版。 So I created another class library for that reference and used the new UtilsDotNet as its reference and problem was fixed. 因此,我为该参考创建了另一个类库,并使用新的UtilsDotNet作为其参考,并解决了问题。

暂无
暂无

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

相关问题 c# 类型在未引用的程序集中定义 - c# The type is defined in an assembly that is not referenced C#出现错误:在未引用的程序集中未定义类型“ Indirect.Class”。 必须添加对程序集“间接”的引用 - C# Getting Error: Type “Indirect.Class” Not Defined In an Assembly Not Referenced . Must Add a reference to assembly “Indirect” 在未引用的程序集中定义的 C# 类型 - C# type defined in an assembly that is not referenced CS0012 C#类型“ HttpContext”在未引用的程序集中定义 - CS0012 C# The type 'HttpContext' is defined in an assembly that is not referenced 在未引用的程序集中定义类型“ x”。 VS 2010 C# - The type “x” is defined in an assembly that is not referenced. VS 2010 C# 该类型在未引用的程序集中定义 - The type is defined in an assembly that is not referenced 间接引用解决方案项目会导致“类型在未引用的程序集中定义” - Indirect reference to solution project causes “Type is defined in an assembly that is not referenced” 类型“ DbConnection”在未引用的程序集中定义。 我无法添加参考? - The type 'DbConnection' is defined in an assembly that is not referenced. I cannot add the reference? 该类型在未引用的程序集中定义。 c#,通用存储库模式,URF - The type is defined in an assembly that is not referenced. c#, Generic Repository Pattern, URF 类型“HttpResponseMessage”是在未引用的程序集中定义的 - The type 'HttpResponseMessage' is defined in an assembly that is not referenced
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM