99 ASP.NET CORE WINDOWS开发环境搭建 - xiaoxin01/Blog GitHub Wiki

本文介绍如何在windoes下搭建ASP.NET CORE开发环境及Linux部署环境

开发环境搭建

安装开发IDE及.NET Core sdk

安装工具可以选择VS Code,也可以选择VS Studio Community(安装后无需再安装SDK),建议使用VS Code,开源免费轻量级且跨平台。

下载vs code,.NET Core sdk:

https://www.microsoft.com/net/core#windowscmd

目前最新版:vs code 1.13,.NET Core 1.1

vs code调试.net core的代码需要额外安装插件:c#,直接在externsions中输入 @sort:installs 列出常用插件就可以看到。

下载git for windows

windows本身没有git源代码管理工具,可以下载git scm:

https://www.git-scm.com/download/win

目前最新版本为2.13.2

如果很慢的话可以从百度盘下载:

https://pan.baidu.com/s/1c2xd1ss

也可以下载图形化管理工具:SourceTree:

https://www.sourcetreeapp.com/

目前SourceTree只有windows和mac版本,还没有Linux版。

Linux部署环境搭建

下载VMware Workstation 12 Player

https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_workstation_player/12_0

下载ubuntu 14.04 server 安装镜像

http://releases.ubuntu.com/trusty/

在VMware上安装ubuntu

安装会比较久时间,建议安装好之后,把vm虚拟文件复制一份做备份,Server搞坏了,可以直接复制过来,比安装快。

另外进入ubuntu之后要注意不要使用VMware的关机,而要在server里面用sudo shutdown -P 0来关机,不然可能会造成无法正确引导进入ubuntu的问题。

安装ssh server,可以用ssh连接Ubuntu OS

sudo apt-get install curl openssh-server ca-certificates postfix

安装Docker和Docker Compose

参照 xxxxx

将windows共享目录挂载到Ubuntu虚拟机

参照xxxxx

目的是为了方便将windows开发环境的代码复制到Linux进行部署和验证,避免频繁提交代码版本

Git源代码控管准备

  1. 检查是否已经有SSH Key存在

windows:

type "%userprofile%\.ssh\id_rsa.pub"

Linux:

cat ~/.ssh/id_rsa.pub 

如果存在,则进入第3步。

  1. 创建SSH keys

打开 git bash,输入:

ssh-keygen -t rsa -C "GitLab" -b 4096

全部默认值,回车

  1. 将SSH Key添加到git账号中

windiws运行下面指令会把公钥复制到剪贴板,然后粘贴到gitlab的user profile里面即可。

type "%userprofile%\.ssh\id_rsa.pub" | clip

linux运行之后再手动复制:

cat ~/.ssh/id_rsa.pub

⚠️ **GitHub.com Fallback** ⚠️