Doraemon

小叮当    2012 - 2023
Doraemon

Choose mode

  • dark
  • auto
  • light
首页
Category
  • 前端开发
  • 后端
  • 数据库
  • 运维
Tag
TimeLine
关于
  • 关于我
Contact
  • GitHub
author-avatar

小叮当

39

Article

25

Tag

首页
Category
  • 前端开发
  • 后端
  • 数据库
  • 运维
Tag
TimeLine
关于
  • 关于我
Contact
  • GitHub

使用VS Code开发.NET Core 0004 - 之程序发布

小叮当    2012 - 2023

使用VS Code开发.NET Core 0004 - 之程序发布


小叮当 2020-11-14 .Net Core后端Dot-net-with-vs-code

# 一、指定项目发布程序

dotnet publish -c release .\Admin.Api\Admin.Api.csproj -o ..\.PublishFiles\Admin.Api
1

# 二、通过 web.config 配置发布程序的环境

项目根目录添加 web.config









 




 





<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\Admin.Api.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" >
        <environmentVariables>
          <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Staging" />
          <!--Development-->
          <!--Staging-->
          <!--Production-->
        </environmentVariables>
      </aspNetCore>
    </system.webServer>
  </location>
</configuration>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

# 三、通过 Windows 批处理发布程序(参考)

color B

del  .PublishFiles\*.*   /s /q

dotnet restore

dotnet build

cd Blog.Core.Api

dotnet publish -o ..\Blog.Core.Api\bin\Debug\netcoreapp3.1\

md ..\.PublishFiles

xcopy ..\Blog.Core.Api\bin\Debug\netcoreapp3.1\*.* ..\.PublishFiles\ /s /e

echo "Successfully!!!! ^ please see the file .PublishFiles"

cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  • 一、指定项目发布程序
  • 二、通过 web.config 配置发布程序的环境
  • 三、通过 Windows 批处理发布程序(参考)