netcmd.exe在IoT Core的新图像上出错

时间:2017-08-28 17:54:24

标签: windows-10-iot-core

DragonBoard 410c

Windows 10 IoT核心v.10.0.16273.1000

我通过SSH连接到计算机并运行Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime, Version=4.0.21.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040),这会导致此错误:

doctor_profiles

直接开箱即用。"

我意识到这是一个内幕预览,但这应该有效,不是吗?我需要连接到企业wifi,这个工具是我知道的唯一方法。

有没有一种快速解决方法,而不涉及等待新版本?

谢谢!

2 个答案:

答案 0 :(得分:0)

NETCMD似乎在10.0.16xxx中被破坏(至少高达16299)。

来自Microsoft

我已经使用类似于WiFiConnect示例的代码。

在BackgroundTask Timer中:

if (!(wifi.IsConnected("WIRELESS_SSID")))
{
   await wifi.WiFiReconnect();
}

在我的WiFi.cs中:

public async Task InitWiFi()
{
    // Request access to WiFiAdapter
    WiFiAccessStatus access = await WiFiAdapter.RequestAccessAsync();

    var result = await DeviceInformation.FindAllAsync(WiFiAdapter.GetDeviceSelector()).AsTask();
    if (result.Count >= 1)
    {
         firstAdapter = await WiFiAdapter.FromIdAsync(result[0].Id);

         await firstAdapter.ScanAsync();
         ssid= firstAdapter.NetworkReport.AvailableNetworks.Where(y => y.Ssid == "YOUR_SSID").FirstOrDefault();
    }

}

public bool IsConnected(string network)
{
    string profileName = GetCurrentWifiNetwork();
    if (!String.IsNullOrEmpty(profileName) && (network == profileName))
    {
        return true;
    }
    return false;
}

public async Task<Boolean> WiFiReconnect()
{
      Task<WiFiConnectionResult> didConnect = null;
      WiFiConnectionResult result = null;
      WiFiReconnectionKind autoConnect = WiFiReconnectionKind.Automatic;
      var credential = new PasswordCredential("DOMAIN", USERNAME, "PASSWORD");
      didConnect = firstAdapter.ConnectAsync(ssid, autoConnect, credential).AsTask();
      result = await didConnect;
      if (result.ConnectionStatus == WiFiConnectionStatus.Success)
      {
           return true;
      }
      else
      {
           return false;
      }
 }

private string GetCurrentWifiNetwork()
{
      var connectionProfiles = NetworkInformation.GetConnectionProfiles();
      if (connectionProfiles.Count < 1)
      {
           return null;
      }
      var validProfiles = connectionProfiles.Where(profile =>
      {
           return (profile.IsWlanConnectionProfile && profile.GetNetworkConnectivityLevel() != NetworkConnectivityLevel.None);
      });
      if (validProfiles.Count() < 1)
      {
           return null;
      }
      ConnectionProfile firstProfile = validProfiles.First();
      return firstProfile.ProfileName;
 }

答案 1 :(得分:0)