我加入了System.Net.Ping
NuGet包到空白UWP項目和Mainpage.xaml.cs
引用的System.Net.NetworkInformation
命名空間。在UWP應用程序中使用System.Net.Ping - 2017年VS
在MainPage構造函數中,我只寫了Ping ping = new Ping()
。
編譯這個簡單的例子,一經推出引發此異常:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Ping, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'System.Net.Ping, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at App2.MainPage..ctor()
at App2.App2_XamlTypeInfo.XamlTypeInfoProvider.Activate_0_MainPage()
at App2.App2_XamlTypeInfo.XamlUserType.ActivateInstance()
at Windows.UI.Xaml.Controls.Frame.Navigate(Type sourcePageType, Object parameter)
at App2.App.OnLaunched(LaunchActivatedEventArgs e)} System.IO.FileNotFoundException
的NuGet包System.Net.Ping
目前在4.3.0版本和4.0.0可用,但是這兩個乖相同。
當我嘗試重新編譯時,恢復失敗,說該軟件包沒有正確的UAP組件......這將解釋爲什麼沒有恢復,並且在運行時無法找到程序集。也許我對你的場景感到困惑? –
發現此問題的任何解決方案? 我正在進入同樣的問題 - 安裝V 4.3.0,而異常是參考V 4.0.0 – Christoph
@Christoph否,對不起。我最終沒有爲我的Szenario使用UWP。由於這本應該運行在帶有Windows 10 IoT核心的Raspberry Pi上,所以我能夠通過使用Raspbian來滿足我的需求。 – guyyst