以下是有关我们开发环境的详细信息:
DevExpress 20.2.3(我们使用的是 DevExtreme)
Microsoft Visual Studio Enterprise 2019(版本 16.4.6)
ASP.NET 核心 3.1.0
AspNetCore.Mvc 3.1.0.0
Microsoft SQL Server 2008 R2 (RTM) –</p>
dotnet –版本 3.1.300
我们的部署服务器环境详细信息是:
Windows Server 2016 标准 64 位操作系统
dotnet –版本 3.1.300
IIS 版本 10
我们的目标是使用 dotnet 命令行构建和部署/打包:
Microsoft Windows [Version 10.0.17763.1697] (c) 2018 Microsoft Corporation. All rights reserved.
C:\Windows\system32>D:
D:>%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
** Visual Studio 2019 Developer Command Prompt v16.8.2 ** Copyright (c) 2020 Microsoft Corporation
D:>cd D:\AppCodeArena\StrangeAcmeApplication\
D:\AppCodeArena\StrangeAcmeApplication>dotnet --version
3.1.300
D:\AppCodeArena\StrangeAcmeApplication>dotnet clean
…..Output...blah….blah….blah…..Output... 0 errors
D:\AppCodeArena\StrangeAcmeApplication>dotnet build -c Release
--runtime win10-x64 .\StrangeAcmeApplication.Uploaders.sln
…..Output...blah….blah….blah…..Output... 0 errors
D:\AppCodeArena\StrangeAcmeApplication>dotnet publish .\src\StrangeAcmeApplication.Uploaders\StrangeAcmeApplication.Uploaders.csproj --runtime win10-x64 --no-build -c Release --output .\PublishedDirectory /p:DebugType=None /p:DebugSymbols=false /p:EnvironmentName=Development --self-contained true
适用于 .NET Core 的 Microsoft (R) Build Engine 版本 16.6.0+5ff7b0c9e 版权所有 (C) Microsoft Corporation。版权所有。
StrangeAcmeApplication.Uploaders -> D:\AppCodeArena\StrangeAcmeApplication\PublishedDirectory\
在 .\PublishedDirectory\appsettings.json 中有以下内容:
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "AllowedHosts": "*" }
在 .\PublishedDirectory\appsettings.Development.json 中有以下内容:
{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "ConnectionStrings": { "dbConnectionString": "Data Source=BlahSQLServerBlah;Initial Catalog=BlahDatabaseInstanceBlah;Persist Security Info=True;User ID=blahUserNameblah;Password=blahblah"
} }
最后在 .\PublishedDirectory\web.config 中,我们有以下内容:
< ?xml version="1.0" encoding="utf-8"?> <configuration> <location path="." inheritInChildApplications="false" >
< system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\InvestorCentral.Uploaders.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess">
<environmentVariables>
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
</environmentVariables>
</aspNetCore>
</system.webServer> </location> </configuration>
应用程序需要发布和部署以下内容:
窗户认证:真
匿名身份验证:假
D:\AppCodeArena\StrangeAcmeApplication>dotnet build -c Release --runtime win10-x64 .\StrangeAcmeApplication.Uploaders.sln
D:\AppCodeArena\StrangeAcmeApplication>dotnet publish .\src\StrangeAcmeApplication.Uploaders\StrangeAcmeApplication.Uploaders.csproj --runtime win10-x64 --no-build -c Release --output .\PublishedDirectory /p:DebugType=None /p :DebugSymbols=false /p:EnvironmentName=Development --self-contained true
有人可以告诉我如何使用带有参数/参数的“dotnet”命令构建或发布应用程序,这些参数还指定以下内容?
窗户认证:真
匿名身份验证:假