Visual Studio for Mac 安装

2019-07-14 02:51发布

有一周时间没有更新博客了,最近这段时间真是苦不堪言,上周四晚上,一杯水将我的MBP报废掉了,开机状态,键盘进水,当场就关机了,很担心当时爆炸了,幸好还只是关机,然后就。。。没有然后了。第二天插电源可以开机,不插电源没法开机,拿到百邦售后服务检测,结果电源已坏,主办多处有烧的痕迹,给我报价,总共需要花4300元,我心已崩溃,不知所言,我说算了吧,不修了,修的钱足够可以买一台新的电脑。电脑刚买一年,就这样报废了,更可怜的是上上周刚换的硬盘,花了1500大洋,真是痛心不已,晚上坐上回山东的高铁,百邦给我打电话说要回收,中间多次要价,最终报废电脑以3800块钱的价格成交,值不值的也就这样了吧,可是不能没有本本用啊,当机立断,看了看转转上的新机,挑了一台价格便宜的,全新未拆的2016款MBP+TouchBar ,13寸+8G+256G,以11000的价格收入囊中,省掉了2888块钱,也算是可以,卖家是老乡山东人,也痛快,虽我是一名.Net开发人,但是偏爱苹果,有点外貌协会,毅然决然的选择了苹果,由于是USB-C接口,又买了一个转接头,才插上了我的U盘,移动硬盘,虽然做什么都有点麻烦,但是比起喜欢,这又算得了什么。 今天的内容是如何安装VS for Mac,我不知道你们安装时是否也遇到问题,也不知道是不是我的网太垃圾的问题,想想还是有必要记录一下吧,不能保证以后会重新装,因为我有点强迫症,要想装什么东西,都必须要全装,不管我是不是能用到,看着那一个个的红 {MOD}感叹号我就难受,安装步骤: 1、首先安装Visual Studio for Mac Preview Installer(下载地址大家去官网下载就可以了),如图:
下一步,点击安装: 勾选同意继续安装,会出来如下界面:
大家可以通过此图看到安装发生错误,具体文本如下: It was not possible to complete an automatic installation. This might be due to a problem with your network, proxy servers or an unsolvable installation conflict. At this point, you can continue the installation by manually downloading and installing the independent pieces. The list below shows each component that you need to install. Mono Framework Download the Mono Framework v4.8.0 archive to any directory on your disk, double-click it and follow the instructions on screen. Please accept all the defaults during the installation, including the target drive. Java SDK Mac OS X uses its own version of Java and in order to install it you need to start the terminal app and type the following command: javac -version After typing it you should see a Mac OS X system popup which will guide you to install the Java software. Android SDK Download the Android SDK for Mac OS X version 24.4.1, open the downloaded archive and copy the contents of the folder found at its root directory (most probably named android-sdk-macosx) to the /Users/allen/Library/Developer/Xamarin/android-sdk-macosx directory. Click here in order to start the Android SDK Manager application. In the GUI make sure the following components are installed or selected for installation: Android SDK Tools Android SDK Platform-tools Android SDK Build-tools Android API 15 Android API 19 Android API 21 Once all the required components are selected (you can select others as well, if you wish) start the installation. If you cannot see /Users/allen/Library/Developer/Xamarin/android-sdk-macosx in Finder please click here to reveal the directory in Finder. Download the Android NDK for Mac OS X version r10e, open the downloaded archive and copy the contents of its root directory (most probably named android-ndk-r10e) to the /Users/allen/Library/Developer/Xamarin/android-ndk directory. When the Android SDK installation is finished you might want to start the Android Emulator Manager and create as many emulator images as you might need for your development. This step can be performed at any time, on an as-needed basis. Visual Studio for Mac Preview Download the Visual Studio for Mac Preview v7.0.0 archive to any directory on your disk, double-click it and then drag and drop the Visual Studio for Mac Preview icon to the Applications folder. Xamarin.Android Download the Xamarin.Android v7.1.0 archive to any directory on your disk, double-click it and follow the instructions on screen. Please accept all the defaults during the installation, including the target drive. Xamarin.iOS Download the Xamarin.iOS v10.4.0 archive to any directory on your disk, double-click it and follow the instructions on screen. Please accept all the defaults during the installation, including the target drive. Xamarin.Mac Download the Xamarin.Mac v3.0.0 archive to any directory on your disk, double-click it and follow the instructions on screen. Please accept all the defaults during the installation, including the target drive. 出现这样的错误,解决办法就是按照提示内容,将所需要下载的模块下载下来单独安装就好了,在这里有两个地方是需要注意的,是关于Android SDK和Android NDK的放置问题,其他的只要下载下dmg文件直接单独安装就可以,重点说一下Android SDK和Android NDK。 首先Android SDK 下载完成后,我这里是这样一个压缩包:android-sdk_r24.4.1-macosx.zip 直接解压,将解压后里面的内容放到上面橙 {MOD}的提示的文件路径下: /Users/allen/Library/Developer/Xamarin/android-sdk-macosx
可以看到此处两个文件目录是不一样的,在下载的包中缺少了platform-tools文件夹,由于我们是需要手动配置Android SDK的位置,需要打开VS for Mac ,当我直接使用下载的包解压后的文件的时候,配置的sdk会提示无法在此位置找到SDK,猜测应该是platform-tools文件,此时可以运行tools文件里的android程序,进行下载sdk,可以不需要全部下载完成,在安装错误的提示内容中“ When the Android SDK installation is finished you might want to start the Android Emulator Manager and create as many emulator images as you might need for your development. This step can be performed at any time, on an as-needed basis.”是这样写的,当然这句话的主要意思还是,你可能需要很多的模拟器镜像,可以进行安装,但这个操作任何时候都可以,所以这个地方,你可以先运行android,只安装一部分,我猜测应该是只要有了platform-tools文件就可以了,这个时候再配置s d k路径,就会提示在指定位置找到了SDK 了。 另外下面Java SDK(JDK)这个直接下载安装即可。 最有点折腾了就是这个Android NDK ,这个下载后是一个bin包,android-ndk-r10e-darwin-x86_64.bin,下载完后需要解压,解压并不是直接打开的方式解压,而是通过命令行解压,命令如下: 1、获取文件权限: chmod a+x android-ndk-r10e-darwin-x86_64.bin    注意这时文件位于系统的根路径,执行完成后,执行下一条命令: 2、解压文件 ./android-ndk-r10e-darwin-x86_64.bin     解压完成后是一个:android-ndk-r10e文件,将这个文件拷贝到: /Users/allen/Library/Developer/Xamarin/android-ndk。目录下,如图:    
然后在VS中配置NDK的位置:/Users/allen/Library/Developer/Xamarin/android-ndk/android-ndk-r10e     至此,大功告成。另外如果是IOS的开发,则需要安装Xcode,安装完成后,Apple SDK位置会自动配置完成。关于Android的各个系统版本的模拟器,需要自己运行Android SDK Manager 下载了。 这一篇博客只记录这些内容,这周要开始继续之前的.Net Core了,最近工作一直忙,电脑也加上报废了,浪费了好多时间,晚上继续还得安装Windows环境,实在是痛苦至极!!!