Can't use debugger for xamarin android project: System.IO.FileNotFoundException: Could not load file or assembly Mono.Posix

狂风中的少年 提交于 2021-02-08 14:09:04

问题


After upgrading my visual studio 2017 to 15.2v (26430.12)

Xamarin.Android SDK 7.3.1.2 (9dbc4c5)

Can't use the debugger anymore. The project builds successfully and deployment finishes but then this error happens:

Could not load file or assembly Mono.Posix

Full error message:


回答1:


Elvis' answer is correct. However in addition to copying the file Mono.Posix.dll to the correct location, you also need to unblock the file by right clicking on the file, selecting properties and checking the unblock box. After that you need to restart Visual Studio.




回答2:


This is a Known Issue. The root cause is lacking of Mono.Posix.dll file under C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Xamarin.VisualStudio\.

So, to fix the problem, you can download the dll file from attached file and copy it to the up mentioned location.




回答3:


This problem has affected two different PC's of mine. At first I first thought it was related to upgrades to VS when it occurred on my first PC. However, it has impacted my second PC after I upgraded from 23.3.0 to 25.3.1 without updating VS.

I am going to avoid 25.3.1 and revert to 23.3.0.

BTW I tried woelliJ's solution but it didn't work for me.




回答4:


For me it helped to;

  • Disable "Use Shared Runtime" on the Android project.
  • Delete the App from the emulator.
  • Delete the Mono runtime from the emulator
  • Clean -> Rebuild -> Deploy without debugging and then starting a debug session

Later on I could switch "Use Shared Runtime" back on and it has been working since.




回答5:


Temporary workaround:

  1. Download the missing Mono.Posix file and unzip the archive.
  2. Right-click the Mono.Posix.dll file in Explorer and select Properties.
  3. Check the Digital Signatures tab to ensure the file shows a valid Xamarin Inc. signature.
  4. At the bottom of the General tab, if an Unblock checkbox appears, enable it and select OK. (This checkbox appears depending on how the file was downloaded.)
  5. For Visual Studio 2017, copy the Mono.Posix.dll file into the “Xamarin.VisualStudio” extension directory. For example, for a default installation of the Enterprise edition, copy the file into: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Xamarin.VisualStudio
  6. For Visual Studio 2015, copy the file into the “Xamarin\Xamarin” extension directory: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Xamarin\Xamarin\
  7. Quit and restart Visual Studio.


来源:https://stackoverflow.com/questions/44364657/cant-use-debugger-for-xamarin-android-project-system-io-filenotfoundexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!