更新源仓库,安装 .NET SDK,命令如下:
$ sudo zypper update $ sudo zypper install dotnet-sdk-2.2
Ubuntu 18.04 LTS 版本的系统上:
注册微软的密钥和 .NET Core 仓库源,命令如下:
$ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb $ sudo dpkg -i packages-microsoft-prod.deb
使 Universe 仓库可用:
$ sudo add-apt-repository universe
然后,安装 .NET Core SDK ,命令如下:
$ sudo apt-get install apt-transport-https $sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2
Ubuntu 16.04 LTS 版本的系统上:
注册微软的密钥和 .NET Core 仓库源,命令如下:
$ wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb $ sudo dpkg -i packages-microsoft-prod.deb
然后安装 .NET core SDK:
$ sudo apt-get install apt-transport-https $ sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2
创建你的第一个应用程序
我们已经成功的在 Linux 机器中安装了 .NET Core SDK。是时候使用 dotnet 创建第一个应用程序了。
接下来的目的,我们会创建一个名为 ostechnixApp 的应用程序。为此,可以简单的运行如下命令:
$ dotnet new console -o ostechnixApp
示例输出:
Welcome to .NET Core! --------------------- Learn more about .NET Core: https://aka.ms/dotnet-docs Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs -
Telemetry --------- 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. -
Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry -
ASP.NET Core ------------ Successfully installed the ASP.NET Core HTTPS Development Certificate. 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. For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. Getting ready... The template "Console Application" was created successfully. -
Processing post-creation actions... Running 'dotnet restore' on ostechnixApp/ostechnixApp.csproj... Restoring packages for /home/sk/ostechnixApp/ostechnixApp.csproj... Generating MSBuild file /home/sk/ostechnixApp/obj/ostechnixApp.csproj.nuget.g.props. Generating MSBuild file /home/sk/ostechnixApp/obj/ostechnixApp.csproj.nuget.g.targets. Restore completed in 894.27 ms for /home/sk/ostechnixApp/ostechnixApp.csproj. -
Restore succeeded.
正如上面的输出所示的,.NET 已经为我们创建一个控制台类型的应用程序。-o 参数创建了一个名为 “ostechnixApp” 的目录,其包含有存储此应用程序数据所必需的文件。
(编辑:ASP站长网)
|