2013-03-25 7 views
0

최근에 내가했던 WPF 응용 프로그램에이 코드를 만들었습니다. 코드를 재사용하는 프로젝트는 Windows 8 응용 프로그램입니다. 코드 자체는 동일하므로 문제가 무엇인지 실제로 알지 못합니다. 물론 이들 사이의 유일한 차이점은 응용 프로그램과 .NET Framework가 사용되고 있다는 것입니다. WPF 응용 프로그램에서는 .NET 3.0을, Windows 8 응용 프로그램에서는 .NET 4.5를 사용하고 있습니다.네트워크 인터페이스에 ""에 대한 정의가 없습니다.

이이 확장 방법이다 말할 수 :

public static bool isTunnel(this NetworkInterface adapter) 
     { 
      return adapter.NetworkInterfaceType == NetworkInterfaceType.Tunnel; 
     } 

은 그 방법에 대해 제공 오류는 다음과 같습니다 내 모델 클래스에서

Error 3 'System.Net.NetworkInformation.NetworkInterface' does not contain a definition for 'NetworkInterfaceType' and no extension method 'NetworkInterfaceType' accepting a first argument of type 'System.Net.NetworkInformation.NetworkInterface' could be found (are you missing a using directive or an assembly reference?) 

Error 4 The name 'NetworkInterfaceType' does not exist in the current context 

내가 유사한 문제에 봉착했습니다. 이 라인에 :

foreach (NetworkInterface adapter in NetworkInterface.GetAllNetworkInterfaces()) 

IT는 GetAllNetworkInterfaces는()의 NetworkInterface에 존재하지 않는 없다는 오류가 발생합니다. 정확한 오류는 다음과 같습니다.

Error 15 'System.Net.NetworkInformation.NetworkInterface' does not contain a definition for 'GetAllNetworkInterfaces' 

Windows 8 응용 프로그램에서 WPF 응용 프로그램의 코드를 재사용하는 것에 대해 모르는 내용이 있습니까?

업데이트 : ianainterfacetype을 사용하여 이더넷, 무선 또는 터널인지 여부를 알 수 있었기 때문에 확장 방법의 절반을 수정할 수있었습니다. 나는 그들이 VirtualBox 또는 VMware에 의해 만들어 졌는지 알 수있는 방법을 찾고있다.

ianainterfacetype에 대해 알고 싶은 사용자는 here을 찾을 수 있습니다.

+0

WinRT의 네트워크 API를 시작하는 데 도움이 될 수 있습니다. http://stackoverflow.com/questions/10336521/query-local-ip-address/10456778#10456778 – Phil

답변

1

GetAllNetworkInterfaces은 Windows 스토어 (메트로) 앱에서 사용할 수 없습니다. MSDN Documentation은 Windows Store 앱에서 GetIsNetworkAvailable 메서드 만 사용할 수 있음을 나타냅니다. 녹색 서류 가방은 Windows Store 응용 프로그램에서 사용할 수 있는지 여부를 나타냅니다.

찾고있는 정보를 제공하는 Windows Store 앱에서 사용할 수있는 API는 알지 못합니다.

+0

해결 방법이 있습니까? – tylerbhughes

+0

@RandomlyKnighted 불행히도 나는 생각하지 않습니다. – vcsjones

+0

해결 방법을 찾았습니다. – tylerbhughes

관련 문제