2015-01-19 3 views
1

저는 VS 2015와 Asp.net 5를 가지고 놀았지만 문제가 있습니다.Asp.net 5 (vNext) Active Directory를 System.DirectoryServices와 함께 사용하는 방법

나는) (Asp.net에서 5

사용 System.DirectoryServices 모두와는 DirectoryEntry 테스트 = 새하여 DirectoryEntry를 System.DirectoryServices를 사용할 수 없습니다입니다; 줄은 빨간색으로 밑줄이 그어져 있지만 오류가 발생합니다.

오류 CS0234 'DirectoryServices'형식 또는 네임 스페이스 이름이 'System'네임 스페이스에 없습니다 (어셈블리 참조가 누락 되었습니까? ?) ConsoleApp.ASP.NET 코어 5.0 Program.cs 2

내 기본 project.json은

{ 
"version": "1.0.0-*", 
"dependencies": { 
}, 
"commands": { 
    "run": "run" 
}, 
"frameworks": { 
    "aspnet50": { }, 
    "aspnetcore50": { 
     "dependencies": { 
      "System.Console": "4.0.0-beta-22231" 
     } 
    } 
} 

}

같았다 그리고 나는

,691로 변경
{ 
"version": "1.0.0-*", 
"dependencies": { 
}, 
"commands": { 
    "run": "run" 
}, 
"frameworks": { 
    "aspnet50": { 
     "frameworkAssemblies": { 
      "System.DirectoryServices": "" 
     } 
    }, 
    "aspnetcore50": { 
     "dependencies": { 
      "System.Console": "4.0.0-beta-22231" 
     } 
    } 
} 

}

내 program.cs을

using System; 
using System.DirectoryServices; 
namespace ConsoleApp 
{ 
public class Program 
{ 
    public void Main(string[] args) 
    { 
     Console.WriteLine("Hello World"); 
     DirectoryEntry test = new DirectoryEntry(); 
     Console.ReadLine(); 
    } 
} 

}

당신을 감사합니다.

답변

4

현재 ASP.net 코어에는 일부 어셈블리가 지원되지 않습니다. project.json 파일은 ASP.net 코어 및 ASP.net50을 활성화합니다.

프레임 워크에서 aspnetcore50을 제거하면 코드가 작동합니다. 당신이 RC 1 ASP.Net 5를 실행하는 경우

{ 
"version": "1.0.0-*", 
"dependencies": { 
}, 
"commands": { 
    "run": "run" 
}, 
"frameworks": { 
    "aspnet50": { 
     "frameworkAssemblies": { 
      "System.DirectoryServices": "" 
     } 
    } 
} 
+0

정말 고마워요! – MSK

+0

그렇다면 asnwer를 수락하십시오. 감사. – dotnetstep

+0

완료! 고맙습니다. :) – MSK

0

, 당신은 당신의 project.json에서 다음과 같이 변경해야합니다.

"frameworks": { 
    "dnx451": { 
     "frameworkAssemblies": { 
     "System.DirectoryServices": "4.0.0.0" 
     }, 
     "dependencies": { } 
    }, 
    "dnxcore50": { } 
    }, 
+0

건물을 열었을 때 System.DirectoryServices 네임 스페이스가 Core 5.0에 존재하지 않는다는 오류가 계속 발생하면 작동하지 않습니다. –

관련 문제