设为首页 - 加入收藏 ASP站长网(Aspzz.Cn)- 科技、建站、经验、云计算、5G、大数据,站长网!
热搜: 数据 手机 公司
当前位置: 首页 > 服务器 > 搭建环境 > Windows > 正文

如何在Linux中安装微软的 .NET Core SDK(2)

发布时间:2019-01-22 05:28 所属栏目:117 来源:Sk
导读:更新源仓库,安装 .NET SDK,命令如下: $ sudo zypper update $ sudo zypper install dotnet-sdk-2.2 Ubuntu 18.04 LTS 版本的系统上: 注册微软的密钥和 .NET Core 仓库源,命令如下: $ wget -q https://package

更新源仓库,安装 .NET SDK,命令如下:

  1. $ sudo zypper update
  2. $ sudo zypper install dotnet-sdk-2.2

Ubuntu 18.04 LTS 版本的系统上:

注册微软的密钥和 .NET Core 仓库源,命令如下:

  1. $ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
  2. $ sudo dpkg -i packages-microsoft-prod.deb

使 Universe 仓库可用:

  1. $ sudo add-apt-repository universe

然后,安装 .NET Core SDK ,命令如下:

  1. $ sudo apt-get install apt-transport-https
  2. $sudo apt-get update
  3. $ sudo apt-get install dotnet-sdk-2.2

Ubuntu 16.04 LTS 版本的系统上:

注册微软的密钥和 .NET Core 仓库源,命令如下:

  1. $ wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
  2. $ sudo dpkg -i packages-microsoft-prod.deb

然后安装 .NET core SDK:

  1. $ sudo apt-get install apt-transport-https
  2. $ sudo apt-get update
  3. $ sudo apt-get install dotnet-sdk-2.2

创建你的第一个应用程序

我们已经成功的在 Linux 机器中安装了 .NET Core SDK。是时候使用 dotnet 创建第一个应用程序了。

接下来的目的,我们会创建一个名为 ostechnixApp 的应用程序。为此,可以简单的运行如下命令:

  1. $ dotnet new console -o ostechnixApp

示例输出:

  1. Welcome to .NET Core!
  2. ---------------------
  3. Learn more about .NET Core: https://aka.ms/dotnet-docs
  4. Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs
  5.  
  6. Telemetry
  7. ---------
  8. The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous and doesn't include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
  9.  
  10. Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
  11.  
  12. ASP.NET Core
  13. ------------
  14. Successfully installed the ASP.NET Core HTTPS Development Certificate.
  15. To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). For establishing trust on other platforms refer to the platform specific documentation.
  16. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
  17. Getting ready...
  18. The template "Console Application" was created successfully.
  19.  
  20. Processing post-creation actions...
  21. Running 'dotnet restore' on ostechnixApp/ostechnixApp.csproj...
  22. Restoring packages for /home/sk/ostechnixApp/ostechnixApp.csproj...
  23. Generating MSBuild file /home/sk/ostechnixApp/obj/ostechnixApp.csproj.nuget.g.props.
  24. Generating MSBuild file /home/sk/ostechnixApp/obj/ostechnixApp.csproj.nuget.g.targets.
  25. Restore completed in 894.27 ms for /home/sk/ostechnixApp/ostechnixApp.csproj.
  26.  
  27. Restore succeeded.

正如上面的输出所示的,.NET 已经为我们创建一个控制台类型的应用程序。-o 参数创建了一个名为 “ostechnixApp” 的目录,其包含有存储此应用程序数据所必需的文件。

(编辑:ASP站长网)

网友评论
推荐文章
    热点阅读