导入的DLL不允许我访问任何类

时间:2013-05-03 17:11:03

标签: c#-4.0 asp.net-mvc-4

所以我创建了一个包含以下内容的类库:

enter image description here

然后我将DLL引用到我的项目中,当我点击它来探索我可以访问的类时,我看到了:

enter image description here

你可以看到没有可访问的类,没有什么。所以我不能进入控制器并添加一个新的控制器,因为从技术上讲,我没有模型或上下文类....

思想?

模型类的示例:

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

namespace UFACoreLibrary.Models
{
    class LocationAssignment
    {
        public int id { get; set; }
        public int locationId { get; set; }
        public string type { get; set; }
        public int typeId { get; set; }

        public virtual Location Location { get; set; }
    }
}

这是一个核心库中某个类看起来像是代码问题的例子。

我正在做的就是构建项目并使用生成的DLL。

1 个答案:

答案 0 :(得分:0)

不幸的是,默认情况下,当您使用向导时,Visual Studio不会将关键字public添加到它填写的类中。您需要添加public以使类在程序集外可见(例如public class LocationAssignment)。