zoukankan      html  css  js  c++  java
  • .NET Core命令

    命令:

    查看版本

    dotnet --version
    

    查看已安装的SDK信息

    #### dotnet --list-sdks
    

    查看已安装的运行时信息

    #### dotnet --list-runtimes
    

    查看帮助命令

    dotnet -h
    

    创建项目(dotnet new)

    dotnet new -i .                             --查看已安装的项目模板
    dotnet new console -o ./myConsole            --通过指定模板创建项目,创建一个控制台项目
    dotnet new -i identityserver4.templates      --安装项目模板
    

    编译项目,生成二进制文件

    dotnet build
    

    发布项目(dotnet publish)

    dotnet publish -o /output -c Release
    

    清理

    dotnet clean
    

    运行项目,相当于F5(dotnet run)

    dotnet run -c Release  --Release版本
    dotnet watch run      --当代码改变时,自动编译运行,开发时使用
    

    下载依赖包(dotnet restore)

    使用NuGet还原在项目文件中定义的依赖关系和项目特定的工具

    dotnet restore    
    

    运行已编译项目

    nohup dotnet xxx.dll &		(ps:必须使用exit退出终端,否则后台进程会退出)
    

    将core项目部署到Linux:

    发布项目:dotnet publish -o /output -c Release
    运行项目:dotnet xxx.dll //编译好的项目直接运行即可
    后台运行项目:nohup dotnet xxx.dll & (ps:必须使用exit退出终端,否则后台进程会退出)

    使用supervisor运行项目:(推荐)

    yum install supervisor
    systemctl start supervisord.service
    touch /etc/supervisord.d/xxx.ini --添加一个项目的配置文件
    systemctl restart supervisord.service

    xxx.init中添加如下内容:

    [program:coreweb1]
    directory=/application/publish/CoreWeb
    command=/usr/bin/dotnet /application/publish/CoreWeb/CoreWeb.dll
    autostart=true
    autorestart=true
    stdout_logfile=/application/publish/logs/out.log
    stderr_logfile=/application/publish/logs/err.log
    
  • 相关阅读:
    Python全栈_Day3_网络基础
    Python全栈_Day2_操作系统基础
    Python全栈_Day1_计算机硬件
    NX二次开发-以指定字符分割字符串
    NX二次开发-获取当前项目路径
    NX二次开发-根据文件名删除文件
    NX二次开发-写入信息窗口
    NX二次开发-读文件
    NX二次开发-获取NX里的对象信息
    NX二次开发-菜单
  • 原文地址:https://www.cnblogs.com/fanfan-90/p/14018145.html
Copyright © 2011-2022 走看看