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
    
  • 相关阅读:
    [转]C#获取程序当前路径的方法
    [解决办法]未在本地计算机上注册“Mircosoft.Jet.OleDB.4.0”提供程序
    [解决办法]正在尝试使用已关闭或释放并且不再有效的 SPWeb 对象
    PowerShell学习笔记
    DNS
    在C#编程中,如何将Excel保存为2003的格式
    SAAS相关网络资源
    LCID及Culture Name列表
    Microsoft's naming conventions (微软命名规范)
    C#中如何结束Excel (Office)进程
  • 原文地址:https://www.cnblogs.com/fanfan-90/p/14018145.html
Copyright © 2011-2022 走看看