Visual Studio For MacOS .NetCore開發踩坑記


  自從Visual Studio For  MacOS公布以來,就開始嘗試在Mac上進行net core開發。斷斷續續遇到了各種奇奇怪怪的問題。雖然大部分利用google查查(百度屁都查不出來),都能找到解決方案,但還是做個記錄吧~

問題一:

錯誤提示:error MSB4057: The target “Build” does not exist in the project

記錄時間:2017-03-31

原因解析:Mono版本低了。對,就是Mono版本低了,別問我為什么開發netcore和mono怎么扯起來聯系的。人家說了:Yes it is a dependency. Currently the updater will not show it as a dependency for technical reasons. Visual Studio (Windows) depends on MSBuild 15 to compile .NET Core projects. Visual Studio for Mac also depends on MSBuild 15 and this is shipped with Mono 4.8. Earlier versions of Mono 4.8 were not including the latest bits to support compiling .NET Core projects。而且這個時間段剛好是netcore項目從xproj文件轉為csproj,所以老版本的不兼容。  我查了下我的mono版本的,是16年的版本,雖然也是4.8.但是小版本號不夠。升級到最新,問題解決。

參考地址:http://www.mono-project.com/  

     http://stackoverflow.com/questions/41773344/project-not-build-in-active-configuration-visual-studio-macos-net-core 

     http://stackoverflow.com/questions/41788027/visual-studio-macos-error-msb4057-the-target-build-does-not-exist-in-the-proj

 

 

問題二:

錯誤提示:Unable to attach to CoreCLR.

記錄時間:2017-04-01

原因解析:我把macos的版本從10.12.3升級到了10.12.4。這里面出現了一些不兼容。  這已經是第二次因為macos版本升級導致netcore不能用了!

解決方案:

  1. Download https://dotnet.myget.org/F/dotnet-core/api/v2/package/runtime.osx.10.10-x64.Microsoft.NETCore.Runtime.CoreCLR/1.1.2-servicing-25123-01
  2. Open the resulting file as a zip, and copy out runtimes/osx.10.10-x64/native/libdbgshim.dylib
  3. Navigate to /Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/AddIns/DotNetCore.Debugger/Adapter/ in Finder or Terminal
  4. Rename libdbgshim.dylib to libdbgshim.dylib.old
  5. Paste in the new libdbgshim.dylib

參考地址: https://github.com/dotnet/coreclr/issues/10279

                https://github.com/dotnet/core/issues/377 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM