컴파일러 오류 CS0012
업데이트: 2007년 11월
오류 메시지
'type' 형식이 참조되지 않은 어셈블리에 정의되었습니다. 'assembly' 어셈블리에 참조를 추가해야 합니다.
The type 'type' is defined in an assembly that is not referenced. You must add a reference to assembly 'assembly'.
참조된 형식의 정의를 찾을 수 없습니다. 이는 필요한 .DLL 파일이 컴파일에 포함되지 않은 경우 일어납니다. 자세한 내용은 참조 추가 대화 상자 및 /reference(메타데이터 가져오기)(C# 컴파일러 옵션)를 참조하십시오.
다음과 같은 순서로 컴파일하면 CS0012 오류가 발생합니다.
// cs0012a.cs
// compile with: /target:library
public class A {}
다음:
// cs0012b.cs
// compile with: /target:library /reference:cs0012a.dll
public class B
{
public static A f()
{
return new A();
}
}
다음:
// cs0012c.cs
// compile with: /reference:cs0012b.dll
class C
{
public static void Main()
{
object o = B.f(); // CS0012
}
}
/reference:b.dll;a.dll을 사용하여 컴파일하면 CS0012 오류를 해결할 수 있습니다.