Visual Studio For MacOS .NetCore開發踩坑記

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

問題一:git

錯誤提示:error MSB4057: The target 「Build」 does not exist in the projectgithub

記錄時間:2017-03-31macos

緣由解析: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.可是小版本號不夠。升級到最新,問題解決。api

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

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

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

 

 

問題二:this

錯誤提示:Unable to attach to CoreCLR.google

記錄時間: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 

相關文章
相關標籤/搜索